[Haskell-cafe] Int vs Integer

Benjamin Franksen benjamin.franksen at bessy.de
Mon Dec 19 17:28:19 EST 2005


On Monday 19 December 2005 11:26, Wolfgang Jeltsch wrote:
> Am Montag, 19. Dezember 2005 01:10 schrieb Jared Updike:
> > Int is for bounded values -2**32 to 2**32 (I think... maybe 2**-31
> > and 2**31 or less if it's boxed?) based on the underlying machine
> > representation.
>
> Not really true.  As far as I remember, the Haskell Report just says
> that Int covers at least the integers from -2^27 to 2^27 - 1.  The
> range for Int can be higher than the range just given.  For 32-bit
> machines it will probably be -2^31 to 2^31 - 1 but there's no
> guarantee for that.

http://www.haskell.org/onlinelibrary/basic.html

6.4  Numbers

...
The finite-precision integer type Int covers at least the range [ - 
2^29, 2^29 - 1]. As Int is an instance of the Bounded class, maxBound 
and minBound can be used to determine the exact Int range defined by an 
implementation. ...

Ben


More information about the Haskell-Cafe mailing list