
Heh, talk about overflow behavior. Here's what GHC does on my 64 bit machine. Note: you need to turn on -fglasgow-exts to force the types this way interactively. As for the tutorials, I have like 10 of them open in different Firefox tabs to different places. Mostly I've been reading up on IO, Monads and other advanced stuff while ignoring basic things I probably should have learned first.
Prelude> let i::Int = 2^62
Prelude> i
4611686018427387904
Prelude> let i::Int = 2^63
Prelude> i
-9223372036854775808
Prelude> let i::Int = 2^64
Prelude> i
0
Prelude> let i::Int = 2^100
Prelude> i
0
Clearly a job for Integer. -Greg
----- Original Message ----
From: Stefan O'Rear
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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front