<div dir="ltr">> That said, I really appreciate Rein's reply and recognize that picking Double for the extended default rules is "a good choice."<div><br></div><div>To follow up a bit, the reason that it's a good choice is pragmatic: we usually prefer to work with such numbers using native floating point math for speed rather than using rational or computable real or other representations which are more accurate but many orders of magnitude slower. If I said 3.5 + 1 in any general purpose language, I would be surprised if it did anything other than an immediate floating point calculation, and so it is (by default) in Haskell.</div><div><br></div><div>If we want another representation then we must reach for it, but we don't need to reach very far.</div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Oct 18, 2015 at 10:05 PM Kim-Ee Yeoh <<a href="mailto:ky3@atamo.com">ky3@atamo.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 18, 2015 at 10:57 PM, 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">Is the behavior I'm seeing actually related to a bug in parsec? </blockquote></div><br></div></div><div dir="ltr"><div class="gmail_extra">If you're interested in digging deeper, I'd say look at the output, not the input end. Almost certainly the machine floating-point double for 3.14 and (3.14+1.0) are identical across ghc, C, and python.<br><br></div><div class="gmail_extra">What's not identical is how different languages choose to display 4.14.<br><br></div><div class="gmail_extra">C and python do some display rounding so you don't see the issue. The display algorithm in Haskell probably goes for the simple, naive approach.<br></div></div><div dir="ltr"><div class="gmail_extra"><br clear="all"><div><div>-- Kim-Ee</div></div>
</div></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">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>
</blockquote></div>