<div dir="ltr"><div style>i had a longer email written out, but decided a shorter one is better.</div><div style><br></div><div style>I warmly point folks to use libs like the numbers package on hackage <a href="http://hackage.haskell.org/packages/archive/numbers/2009.8.9/doc/html/Data-Number-BigFloat.html">http://hackage.haskell.org/packages/archive/numbers/2009.8.9/doc/html/Data-Number-BigFloat.html</a></div>
<div style><br></div><div style>it has some great alternatives to standard floats and doubles.</div><div style><br></div><div style>the big caveat, however, is all your computations will be painfully slower by several orders of magnitude. And sometimes thats a great tradeoff! but sometimes it isnt. At the end of the day, you need to understand how to do math on the computer in a fashion that accepts that there is going to be finite precision. there is no alternative but to work with that understanding.</div>
<div style><br></div><div style>numbers on the computer have many forms. and many tradeoffs. there is no one true single best approach.</div><div style><br></div><div style>cheers</div><div style>-Carter</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Sep 21, 2013 at 10:11 PM, Mike Meyer <span dir="ltr"><<a href="mailto:mwm@mired.org" target="_blank">mwm@mired.org</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"><div class="im"><div>On Sat, Sep 21, 2013 at 5:28 PM, Bardur Arantsson <<a href="mailto:spam@scientician.net" target="_blank">spam@scientician.net</a>> wrote:</div><div>> On 2013-09-21 23:08, Mike Meyer wrote:</div>
<div>> > Exactly. The Eq and Ord instances aren't what's broken, at least when</div>
<div>> > you're dealing with numbers (NaNs are another story). That there are pairs</div><div>> According to Haskell NaN *is* a number.</div><div><br></div></div><div>Trying to make something whose name is "Not A Number" act like a</div>
<div>number sounds broken from the start.</div><div class="im"><div><br></div><div>> > Eq and Ord are just the messengers.</div><div>> No. When we declare something an instance of Monad or Applicative (for</div>
<div>> example), we expect(*) that thing to obey certain laws. Eq and Ord</div>
<div>> instances for Float/Double do *not* obey the expected laws.</div><div><br></div></div><div>I just went back through the thread, and the only examples I could</div><div>find where that happened (as opposed to where floating point</div>
<div>calculations or literals resulted in unexpected values) was with</div><div>NaNs. Just out of curiosity, do you know of any that don't involve</div><div>NaNs?</div><div><br></div><div>Float violates the expected behavior of instances of - well, pretty</div>
<div>much everything it's an instance of. Even if you restrict yourself to</div><div>working with integer values that can be represented as floats. If</div><div>we're going to start removing it as an instance for violating instance</div>
<div>expectations, we might as well take it out of the numeric stack (or</div><div>the language) completely.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div> <mike</div><div><br></div></font></span></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>