Ticket #74 (new defect)

Opened 6 years ago

Data.Word64: arithmetic overflow when evaluating maxBound + 1

Reported by: guest Owned by: nobody
Priority: major Milestone:
Component: hugs Version: 200609
Keywords: Data.Word.Word64, arithmetic overflow Cc:

Description

The function (fromInteger x) in Num(Data.Word.Word64) causes a program error, if x is greater or equal 264. This is particularly annoying when two valid Word64 variables are to be multiplied.

Take for instance

Data.Word> maxbound :: Word64
18446744073709551615
Data.Word> 2*(2^63) :: Word64

Program error: arithmetic overflow

Data.Word> (2^64) :: Word64

Program error: arithmetic overflow

GHC and GHCi return values mod 264, as Hugs does also for Word32 and 232.

Note: See TracTickets for help on using tickets.