[project @ 1999-12-13 17:28:53 by simonmar]
[ghc-hetmet.git] / ghc / tests / numeric / should_run / num009.hs
1 -- !!! tests that minBound::Int is correctly handled (for Int & Integer
2
3 -- (not necessarily Haskell 98: relies on Int being a 32-bit type.)
4
5 main = do
6   print (-2147483648 :: Int)                    -- -2147483648
7   print ((-2147483647)-1 :: Int)                -- -2147483648
8   print (-2147483648 :: Integer)                -- -2147483648
9   print ((-2147483648 :: Int) >= 0)             -- False
10   print ((-2147483648 :: Integer) >= 0)         -- False
11   print (-(-2147483648) :: Int)                 -- <undefined>
12   print (abs (-2147483648) :: Int)              -- <undefined>
13   print (abs ((-2147483647)-1) :: Int)          -- <undefined>
14   print (abs (-2147483648) :: Integer)          -- 2147483648
15   print (abs ((-2147483647)-1) :: Integer)      -- 2147483648 (wrong in 4.04)
16   print (fromInteger (-2147483648 :: Integer) :: Int)      -- -2147483648
17   print (fromInteger ((-2147483647)-1 :: Integer) :: Int)  -- -2147483648