[Hugs] #74: Data.Word64: arithmetic overflow when evaluating maxBound + 1

Hugs trac at galois.com
Mon Jun 11 08:11:28 EDT 2007


#74: Data.Word64: arithmetic overflow when evaluating maxBound + 1
---------------------------------------------------+------------------------
 Reporter:  guest                                  |       Owner:  nobody
     Type:  defect                                 |      Status:  new   
 Priority:  major                                  |   Milestone:        
Component:  hugs                                   |     Version:  200609
 Keywords:  Data.Word.Word64, arithmetic overflow  |  
---------------------------------------------------+------------------------
The function (fromInteger x) in Num(Data.Word.Word64) causes a program
 error, if x is greater or equal 2^64^. 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 2^64^, as Hugs does also for Word32 and
 2^32^.

-- 
Ticket URL: <http://hackage.haskell.org/trac/hugs/ticket/74>
Hugs <http://www.haskell.org/hugs/>
Hugs 98, an interpreter for Haskell


More information about the Hugs-Bugs mailing list