diff options
author | David Terei <davidterei@gmail.com> | 2011-07-20 11:09:03 -0700 |
---|---|---|
committer | David Terei <davidterei@gmail.com> | 2011-07-20 11:26:35 -0700 |
commit | 16514f272fb42af6e9c7674a9bd6c9dce369231f (patch) | |
tree | e4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/lib/Numeric/num008.hs | |
parent | ebd422aed41048476aa61dd4c520d43becd78682 (diff) | |
download | haskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz |
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/lib/Numeric/num008.hs')
-rw-r--r-- | testsuite/tests/lib/Numeric/num008.hs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/testsuite/tests/lib/Numeric/num008.hs b/testsuite/tests/lib/Numeric/num008.hs new file mode 100644 index 0000000000..36158240b4 --- /dev/null +++ b/testsuite/tests/lib/Numeric/num008.hs @@ -0,0 +1,57 @@ +-- showing/reading floats +-- +module Main(main) where + +import Numeric + +main = do + let dbls = map (shEFloat (Just 7)) doubles + ++ map (shEFloat (Just 0)) doubles + ++ map (shEFloat Nothing) doubles + ++ map (shFFloat (Just 7)) doubles + ++ map (shFFloat (Just 0)) doubles + ++ map (shFFloat Nothing) doubles + ++ map (shGFloat (Just 7)) doubles + ++ map (shGFloat (Just 0)) doubles + ++ map (shGFloat Nothing) doubles + + flts = map (shEFloat (Just 7)) floats + ++ map (shEFloat (Just 0)) floats + ++ map (shEFloat Nothing) floats + ++ map (shFFloat (Just 7)) floats + ++ map (shFFloat (Just 0)) floats + ++ map (shFFloat Nothing) floats + ++ map (shGFloat (Just 7)) floats + ++ map (shGFloat (Just 0)) floats + ++ map (shGFloat Nothing) floats + + putStrLn (unlines dbls) + putStrLn (unlines flts) + print (map read dbls :: [Double]) + print (map read flts :: [Double]) + +shEFloat p f = showEFloat p f "" +shFFloat p f = showFFloat p f "" +shGFloat p f = showGFloat p f "" + +doubles :: [ Double ] +doubles = [ 0.0 + , 420 + , 42 + , 4.2 + , 0.42 + , 0.042 + , 1.82173691287639817263897126389712638972163 + , 1.82173691287639817263897126389712638972163e-300 + ] + +floats :: [ Float ] +floats = [ 0.0 + , 420 + , 42 + , 4.2 + , 0.42 + , 0.042 + , 1.82173691287639817263897126389712638972163 + , 1.82173691287639817263897126389712638972163e-300 + ] |