From 9b92f83de147b9bcf74ff2bb5b40ff9af145f934 Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Thu, 29 Jan 1998 13:49:39 +0000 Subject: [PATCH] [project @ 1998-01-29 13:49:38 by sof] Added test case for showing Floats and Doubles. --- ghc/tests/numeric/should_run/arith005.hs | 79 ++++++++------------ ghc/tests/numeric/should_run/arith005.stdout | 42 ++++++----- 2 files changed, 55 insertions(+), 66 deletions(-) diff --git a/ghc/tests/numeric/should_run/arith005.hs b/ghc/tests/numeric/should_run/arith005.hs index c472bdda1e83..00b025c1f662 100644 --- a/ghc/tests/numeric/should_run/arith005.hs +++ b/ghc/tests/numeric/should_run/arith005.hs @@ -1,60 +1,47 @@ --!!! 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 ] diff --git a/ghc/tests/numeric/should_run/arith005.stdout b/ghc/tests/numeric/should_run/arith005.stdout index 521d36df5297..041064f438dd 100644 --- a/ghc/tests/numeric/should_run/arith005.stdout +++ b/ghc/tests/numeric/should_run/arith005.stdout @@ -1,20 +1,22 @@ -[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)] -- GitLab