Skip to content
Snippets Groups Projects
Commit 9b92f83d authored by sof's avatar sof
Browse files

[project @ 1998-01-29 13:49:38 by sof]

Added test case for showing Floats and Doubles.
parent d67e82cf
No related merge requests found
--!!! test RealFrac ops (ceiling/floor/etc.) on Floats/Doubles
--
main
= putStr
(-- {Float,Double} inputs, {Int,Integer} outputs
show ((map ceiling float_list) :: [Int])
++ "\n"
++ show ((map ceiling float_list) :: [Integer])
++ "\n"
++ show ((map ceiling double_list) :: [Int])
++ "\n"
++ show ((map ceiling double_list) :: [Integer])
++ "\n"
++ show ((map floor float_list) :: [Int])
++ "\n"
++ show ((map floor float_list) :: [Integer])
++ "\n"
++ show ((map floor double_list) :: [Int])
++ "\n"
++ show ((map floor double_list) :: [Integer])
++ "\n"
++ show ((map truncate float_list) :: [Int])
++ "\n"
++ show ((map truncate float_list) :: [Integer])
++ "\n"
++ show ((map truncate double_list) :: [Int])
++ "\n"
++ show ((map truncate double_list) :: [Integer])
++ "\n"
++ show ((map round float_list) :: [Int])
++ "\n"
++ show ((map round float_list) :: [Integer])
++ "\n"
++ show ((map round double_list) :: [Int])
++ "\n"
++ show ((map round double_list) :: [Integer])
++ "\n"
++ show ((map properFraction float_list) :: [(Int,Float)])
++ "\n"
++ show ((map properFraction float_list) :: [(Integer,Float)])
++ "\n"
++ show ((map properFraction double_list) :: [(Int,Double)])
++ "\n"
++ show ((map properFraction double_list) :: [(Integer,Double)])
++ "\n"
)
main =
putStr $
unlines
[ -- just for fun, we show the floats to
-- exercise the code responsible.
show (float_list :: [Float])
, show (double_list :: [Double])
-- {Float,Double} inputs, {Int,Integer} outputs
, show ((map ceiling float_list) :: [Int])
, show ((map ceiling float_list) :: [Integer])
, show ((map ceiling double_list) :: [Int])
, show ((map ceiling double_list) :: [Integer])
, show ((map floor float_list) :: [Int])
, show ((map floor float_list) :: [Integer])
, show ((map floor double_list) :: [Int])
, show ((map floor double_list) :: [Integer])
, show ((map truncate float_list) :: [Int])
, show ((map truncate float_list) :: [Integer])
, show ((map truncate double_list) :: [Int])
, show ((map truncate double_list) :: [Integer])
, show ((map round float_list) :: [Int])
, show ((map round float_list) :: [Integer])
, show ((map round double_list) :: [Int])
, show ((map round double_list) :: [Integer])
, show ((map properFraction float_list) :: [(Int,Float)])
, show ((map properFraction float_list) :: [(Integer,Float)])
, show ((map properFraction double_list) :: [(Int,Double)])
, show ((map properFraction double_list) :: [(Integer,Double)])
]
where
float_list :: [Float]
float_list = [
0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995,
-3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25,
102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi
102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi,
1.18088e+11, 1.2111e+14
]
double_list :: [Double]
double_list = [
0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995,
-3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25,
102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi
102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi,
1.18088e+11, 1.2111e+14
]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4]
[0, 0, 1, 2, 3, 4, -1, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3]
[0, 0, 1, 2, 3, 4, -2, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3]
[0, 0, 1, 2, 3, 4, -2, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3]
[(0, 0.0), (0, 0.0), (1, 0.100000024), (2, 0.79999995), (3, 0.5), (4, 0.5), (-1, 0.0), (-2, -0.9999995), (-3, -0.5), (-4, -0.5), (1000012, 0.0), (123, 0.45600128), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159274)]
[(0, 0.0), (0, 0.0), (1, 0.100000024), (2, 0.79999995), (3, 0.5), (4, 0.5), (-1, 0.0), (-2, -0.9999995), (-3, -0.5), (-4, -0.5), (1000012, 0.0), (123, 0.45600128), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159274)]
[(0, 0.0), (0, 0.0), (1, 0.10000000000000009), (2, 0.7999999999999998), (3, 0.5), (4, 0.5), (-1, -1.000000082740371e-10), (-2, -0.9999994999999999), (-3, -0.50000000001), (-4, -0.49999999999), (1000012, 0.0), (123, 0.45600000000000307), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159265358979312)]
[(0, 0.0), (0, 0.0), (1, 0.10000000000000009), (2, 0.7999999999999998), (3, 0.5), (4, 0.5), (-1, -1.000000082740371e-10), (-2, -0.9999994999999999), (-3, -0.50000000001), (-4, -0.49999999999), (1000012, 0.0), (123, 0.45600000000000307), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159265358979312)]
[0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0, -2.9999995, -3.5, -4.5, 1000012.0, 123.456, 100.25, 102.5, 1.2e-3, -1.2e-7, 17000.0, -1.7e-4, 1.5e-7, 3.1415927, 1.18088e11, 1.2111e14]
[0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995, -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25, 102.5, 1.2e-3, -1.2e-7, 17000.0, -1.7e-4, 1.5e-7, 3.141592653589793, 1.18088e11, 1.2111e14]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4, 2123882496, 511705088]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4, 118087999488, 121109999517696]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4, 2123883008, 512187392]
[0, 0, 2, 3, 4, 5, -1, -2, -3, -4, 1000012, 124, 101, 103, 1, 0, 17000, 0, 1, 4, 118088000000, 121110000000000]
[0, 0, 1, 2, 3, 4, -1, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3, 2123882496, 511705088]
[0, 0, 1, 2, 3, 4, -1, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3, 118087999488, 121109999517696]
[0, 0, 1, 2, 3, 4, -2, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3, 2123883008, 512187392]
[0, 0, 1, 2, 3, 4, -2, -3, -4, -5, 1000012, 123, 100, 102, 0, -1, 17000, -1, 0, 3, 118088000000, 121110000000000]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 2123882496, 511705088]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 118087999488, 121109999517696]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 2123883008, 512187392]
[0, 0, 1, 2, 3, 4, -1, -2, -3, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 118088000000, 121110000000000]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 2123882496, 511705088]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 118087999488, 121109999517696]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 2123883008, 512187392]
[0, 0, 1, 3, 4, 4, -1, -3, -4, -4, 1000012, 123, 100, 102, 0, 0, 17000, 0, 0, 3, 118088000000, 121110000000000]
[(0, 0.0), (0, 0.0), (1, 0.100000024), (2, 0.79999995), (3, 0.5), (4, 0.5), (-1, 0.0), (-2, -0.9999995), (-3, -0.5), (-4, -0.5), (1000012, 0.0), (123, 0.45600128), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159274), (2123882496, 0.0), (511705088, 0.0)]
[(0, 0.0), (0, 0.0), (1, 0.100000024), (2, 0.79999995), (3, 0.5), (4, 0.5), (-1, 0.0), (-2, -0.9999995), (-3, -0.5), (-4, -0.5), (1000012, 0.0), (123, 0.45600128), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159274), (118087999488, 0.0), (121109999517696, 0.0)]
[(0, 0.0), (0, 0.0), (1, 0.10000000000000009), (2, 0.7999999999999998), (3, 0.5), (4, 0.5), (-1, -1.000000082740371e-10), (-2, -0.9999994999999999), (-3, -0.50000000001), (-4, -0.49999999999), (1000012, 0.0), (123, 0.45600000000000307), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159265358979312), (2123883008, 0.0), (512187392, 0.0)]
[(0, 0.0), (0, 0.0), (1, 0.10000000000000009), (2, 0.7999999999999998), (3, 0.5), (4, 0.5), (-1, -1.000000082740371e-10), (-2, -0.9999994999999999), (-3, -0.50000000001), (-4, -0.49999999999), (1000012, 0.0), (123, 0.45600000000000307), (100, 0.25), (102, 0.5), (0, 1.2e-3), (0, -1.2e-7), (17000, 0.0), (0, -1.7e-4), (0, 1.5e-7), (3, 0.14159265358979312), (118088000000, 0.0), (121110000000000, 0.0)]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment