
17 Oct
2015
17 Oct
'15
10:21 p.m.
On Sat, Oct 17, 2015 at 7:17 PM, Frothy Bits
Greetings,
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 4.1400000000000001
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. -- Dan Stromberg