Opened 17 years ago

Closed 16 years ago

Last modified 48 years ago

#516 closed bug (Rejected)

fromInteger :: Integer -> Int should fail on overflow

Reported by: simonpj Owned by: nobody
Priority: lowest Milestone:
Component: Prelude Version: None
Keywords: Cc:
Operating System: Architecture:
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


fromInteger 4000000000 :: Int gives -294967296

This is bad; it should really raise an exception.

I believe this is the case with all versions of GHC

Change History (1)

comment:1 Changed 16 years ago by simonmar

Status: assignedclosed
Logged In: YES 

fromInteger where the destination type is Int has well 
defined behaviour on overflow, this is now documented in 
the User's Guide.
Note: See TracTickets for help on using tickets.