2 module Main(main) where
19 doubles = [ -1.2 , 0, 0.1, 0.5, 1.0, 1234.45454,
20 1.6053e4, 1.64022e12, 6.894e-4, 6.34543455634582173,
21 5342413403.40540423255]
23 ints = [ 0, 1, 255, 65513, 6029, 1024, 256, 201357245]
26 integers = [ 0, 1, 255, 65513, 6029, 1024, 256,
27 2343243543500233, 656194962055457832]
30 test_doubleToFloat :: IO ()
31 test_doubleToFloat = do
32 test_banner "doubleToFloat"
33 putStrLn (show doubles)
34 putStrLn (show $ map doubleToFloat doubles)
36 test_floatToDouble :: IO ()
37 test_floatToDouble = do
38 test_banner "doubleToFloat"
39 putStrLn (show doubles)
40 putStrLn (show $ map doubleToFloat doubles)
41 putStrLn (show $ map (floatToDouble.doubleToFloat) doubles)
47 putStrLn (showList' (map showHex ints))
48 putStrLn (show integers)
49 putStrLn (showList' (map showHex integers))
51 showList' :: [ShowS] -> String
53 showList' (x:xs) = showChar '[' . x $ showl xs ""
55 showl [] = showChar ']'
56 showl (x:xs) = showChar ',' . x . showl xs
63 putStrLn (showList' (map showOct ints))
64 putStrLn (show integers)
65 putStrLn (showList' (map showOct integers))
68 test_banner :: String -> IO ()
70 putStrLn $ "--------------------------------"
71 putStrLn $ "--Testing " ++ tst
72 putStrLn $ "--------------------------------"