[Haskell-cafe] Proper Handling of Exceptional IEEE Floating Point Numbers

John Lato jwlato at gmail.com
Fri Apr 23 12:16:44 EDT 2010

> From: "Barak A. Pearlmutter" <barak at cs.nuim.ie>
>> ... An invalid comparison evaluating to _|_ is arguably more
>> correct, but I personally find the idea of introducing more bottoms
>> rather distasteful.
> Too late!  NaN is pretty much the _|_ of IEEE Floating Point.
> That was certainly the intent of the IEEE standard, and is why NaN is
> so contagious.  But they wanted to relax the usual strictness of their
> languages (FORTRAN, C) when this particular _|_ is around.  So NaN is
> contagious through strict arithmetic (+, *, etc) like _|_.  But it has
> strange behaviour with respect to comparison.  In the context of
> Haskell, which does not have the issue of needing to relax strictness
> just for NaN, I think the "right thing" would be to have compare give
> _|_, and maybe also <, >, ==.  After all, NaN is outside the carefully
> defined total ordering of all other IEEE floating point values
> including +/- Infinity.



More information about the Haskell-Cafe mailing list