[Haskell-beginners] ghci: inconsistent return values for succ
strombrg at gmail.com
Sun Oct 18 02:21:47 UTC 2015
On Sat, Oct 17, 2015 at 7:17 PM, Frothy Bits <neuralpancake at gmail.com>
> Absolutely brand new to Haskell. Taking ghci v7.10.2 out for a spin, and
> I find I get inconsistent return values for succ n:
> ghci> succ 3.14
> for example instead of the expected 4.14
This is pretty standard for today's floating point hardware in CPU's. It's
not a Haskell thing. It comes up in C and Python too - that is, in pretty
much anything that uses hardware floating point.
If you need precision, try an integral type or a rational.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners