[project @ 1998-01-07 18:12:40 by simonm]
[ghc-hetmet.git] / ghc / tests / numeric / should_run / arith005.hs
1 --!!! test RealFrac ops (ceiling/floor/etc.) on Floats/Doubles
2 --
3 main
4   = putStr
5        (-- {Float,Double} inputs, {Int,Integer} outputs
6         show ((map ceiling float_list) :: [Int])
7         ++ "\n"
8         ++ show ((map ceiling float_list) :: [Integer])
9         ++ "\n"
10         ++ show ((map ceiling double_list) :: [Int])
11         ++ "\n"
12         ++ show ((map ceiling double_list) :: [Integer])
13         ++ "\n"
14         ++ show ((map floor float_list) :: [Int])
15         ++ "\n"
16         ++ show ((map floor float_list) :: [Integer])
17         ++ "\n"
18         ++ show ((map floor double_list) :: [Int])
19         ++ "\n"
20         ++ show ((map floor double_list) :: [Integer])
21         ++ "\n"
22         ++ show ((map truncate float_list) :: [Int])
23         ++ "\n"
24         ++ show ((map truncate float_list) :: [Integer])
25         ++ "\n"
26         ++ show ((map truncate double_list) :: [Int])
27         ++ "\n"
28         ++ show ((map truncate double_list) :: [Integer])
29         ++ "\n"
30         ++ show ((map round float_list) :: [Int])
31         ++ "\n"
32         ++ show ((map round float_list) :: [Integer])
33         ++ "\n"
34         ++ show ((map round double_list) :: [Int])
35         ++ "\n"
36         ++ show ((map round double_list) :: [Integer])
37         ++ "\n"
38         ++ show ((map properFraction float_list) :: [(Int,Float)])
39         ++ "\n"
40         ++ show ((map properFraction float_list) :: [(Integer,Float)])
41         ++ "\n"
42         ++ show ((map properFraction double_list) :: [(Int,Double)])
43         ++ "\n"
44         ++ show ((map properFraction double_list) :: [(Integer,Double)])
45         ++ "\n"
46         )
47   where
48     float_list :: [Float]
49     float_list = [
50         0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995,
51         -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25,
52         102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi
53       ]
54
55     double_list :: [Double]
56     double_list = [
57         0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995,
58         -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25,
59         102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi
60       ]