[Haskell-cafe] Re: Why purely in haskell?

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Fri Jan 11 06:41:29 EST 2008


Am Freitag, 11. Januar 2008 11:33 schrieben Sie:
> Wolfgang Jeltsch <g9ks157k at acme.softbase.org> writes:
> > However, the fact that (0 / 0) == (0 / 0) yields False is quite shocking.
> >  It doesn’t adhere to any meaningful axiom set for Eq.
>
> Tough luck, but that's how floating point works, and what the
> numericalists know, and possibly even love (although I have my
> doubts).  Sanitizing this behavior would make Haskell less usable for
> real-world numerical problems.

The IEEE floating point equivalence test has to yield false when comparing NaN 
with NaN.  Haskell’s (==) has to yield True or undefined when comparing a 
value with itself.  So Haskell’s (==) just has to be different from the IEEE 
floating point equivalence test.  What about providing a separate function 
for the latter?

> As a compromise, what about an option to make NaN (and presumably the
> infinities) cause an immediate exception?  (And, cetero censeo,
> exceptions for Int overflow as well.)

This would be far better (and far more Haskell-like).

> -k

Best wishes,
Wolfgang


More information about the Haskell-Cafe mailing list