[Haskell-cafe] Simple newbie question - Int and Integer

Stefan O'Rear stefanor at cox.net
Thu Jul 12 14:48:15 EDT 2007


On Thu, Jul 12, 2007 at 07:39:09PM +0100, Andrew Coppin wrote:
> Gregory Propf wrote:
>> So what the hell is the difference between them?  Int and Integer.  They 
>> aren't synonyms clearly.  What's going on?
>
> Int = 32-bit integer.

Int = 30 bits with undefined overflow behavior

That "undefined" gives implementations the freedom to use bigger
representations if convenient.

GHC: 31, 32 or 64 bits (from source code)
Hugs: 32 bits (only tested on a 32 bit computer)
YHC: 32 or 64 bits (from source code)
JHC: Buggy (maxBound :: Int is negative)

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070712/bd0b19fa/attachment.bin


More information about the Haskell-Cafe mailing list