
Hi, This is my first time with Haskell. Here is what I found while trying out some examples : Prelude> round 3.499999999999999 3 it :: Integer Prelude> round 3.4999999999999999 4 it :: Integer --------------- Prelude> round 111111.49999999999 111111 it :: Integer Prelude> round 111111.499999999999 111112 it :: Integer Is it something to do with the CPU register size ?

Double doesn't have so much precision at that value. It has nothing
to do with the round function.
Prelude> 3.499999999999999 :: Double
3.499999999999999
Prelude> 3.4999999999999999 :: Double
3.5
On Sun, May 29, 2011 at 2:39 AM, Prashant Shah
Hi,
This is my first time with Haskell.
Here is what I found while trying out some examples :
Prelude> round 3.499999999999999 3 it :: Integer
Prelude> round 3.4999999999999999 4 it :: Integer
---------------
Prelude> round 111111.49999999999 111111 it :: Integer Prelude> round 111111.499999999999 111112 it :: Integer
Is it something to do with the CPU register size ?
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (2)
-
David McBride
-
Prashant Shah