Hello,

Anybody know why in the following program 2147483648::Word32
is printed as '0'?

If I use 2147483647 (2^31-1) it prints correctly.
Using 1::Word32 shift 31 gives the expected value
and maxBound::Word32 gives 2^32 as expected, so it would
seem there is something wrong in the scanner/parser.

Tested using ghc-3.00 on Linux.

Any ideas how to fix this?


Thanks,

Hennus Bergman

--------------chop here---------------

module Main (main) where

import Word
import Bits

main = do putStr ("This should be: " ++ show word31 ++ " == 2147483648?\n")

word31 :: Word32
word31 = (2147483648::Word32)           -- This gives the value '0'
--word31  = (1::Word32) shift 31        -- This gives the expected value

maxword32 :: Word32
maxword32 = (maxBound::Word32)          -- The only? way to get 2^32 directly for 
Word32

--------------chop here---------------

Reply via email to