Commit 8632e56a authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add a test for showing Doubles

In particular, show (Just (-0/1)) should put parens around the -0.0 in
Just (-0.0); trac #2036.
parent a8eb6faf
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
test('showDouble', normal, compile_and_run, [''])
module Main (main) where
main :: IO ()
main = do let xs = [p0, p01, p3, p31, n0, n01, n3, n31, pinf, ninf, nan]
mapM_ print xs
mapM_ (print . Just) xs
p0 :: Double
p0 = 0
p01 :: Double
p01 = 0.1
p3 :: Double
p3 = 3
p31 :: Double
p31 = 3.1
n0 :: Double
n0 = -0
n01 :: Double
n01 = -0.1
n3 :: Double
n3 = -3
n31 :: Double
n31 = -3.1
pinf :: Double
pinf = 1 / 0
ninf :: Double
ninf = - 1 / 0
nan :: Double
nan = 0 / 0
0.0
0.1
3.0
3.1
-0.0
-0.1
-3.0
-3.1
Infinity
-Infinity
NaN
Just 0.0
Just 0.1
Just 3.0
Just 3.1
Just (-0.0)
Just (-0.1)
Just (-3.0)
Just (-3.1)
Just Infinity
Just (-Infinity)
Just NaN
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment