Testsuite: tabs -> spaces [skip ci]
[ghc.git] / testsuite / tests / numeric / should_run / arith001.hs
1 -- !!! conversions: Double <=> Rational/Integer things
2 --
3 import Data.Ratio
4
5 main = putStr (show r42 ++ "\n" ++
6 show nu42 ++ ", " ++
7 show de42 ++ "\n" ++
8 show nu42d ++ ", " ++
9 show de42d ++ "\n" ++
10 show s2 ++ ", " ++
11 show e2 ++ "\n" ++
12 show s ++ ", " ++
13 show e ++ "\n" )
14 where
15 d42 :: Double
16 r42 :: Rational
17 nu42, de42 :: Integer
18 nu42d, de42d :: Double
19
20 d42 = 42
21 r42 = toRational d42
22 nu42 = numerator r42
23 de42 = denominator r42
24 nu42d= fromInteger nu42
25 de42d= fromInteger de42
26
27 (s,e)= decodeFloat (nu42d / de42d )
28 (s2,e2) = decodeFloat d42