[Haskell-beginners] ghci: inconsistent return values for succ
Frothy Bits
neuralpancake at gmail.com
Sun Oct 18 02:17:04 UTC 2015
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
succ 2.14 and 4.14 give the expected results. but succ 2.14 returns
2.1399999999999997. This anomalous behavior runs through the range of
n.nn; in the n.01 range, for example, 16.01 and 63.01 return wonky results
per above.
I tested this on Windows and Linux (various flavors) and I get the same
results there and in the interactive test code space on haskell.org.
I'm not familiar enough with the language, yet, to go debugging this on my
own, but it would seem to be at least a problem with how succ is
implemented, if not how values are handled in general.....which could
potentially be bad if you were trying to do anything requiring precise
calculations....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151017/7ae9d3da/attachment.html>
More information about the Beginners
mailing list