<div dir="ltr">If you use Decimal package [0], you can have what you want:<div><br></div><div><div>λ succ (3.14 :: Decimal)</div><div>4.14</div><div><br></div><div>[0]: <a href="https://hackage.haskell.org/package/Decimal">https://hackage.haskell.org/package/Decimal</a></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 18, 2015 at 5:17 AM, Frothy Bits <span dir="ltr"><<a href="mailto:neuralpancake@gmail.com" target="_blank">neuralpancake@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Greetings,<div><br></div><div>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:</div><div><br></div><div>ghci> succ 3.14</div><div>4.1400000000000001  </div><div><br></div><div>for example instead of the expected 4.14</div><div><br></div><div>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.</div><div><br></div><div>I tested this on Windows and Linux (various flavors) and I get the same results there and in the interactive test code space on <a href="http://haskell.org" target="_blank">haskell.org</a>.</div><div><br></div><div>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....</div><div><br></div></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>