[Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

Casey McCann syntaxglitch at gmail.com
Thu Apr 8 20:30:09 EDT 2010

On Thu, Apr 8, 2010 at 7:58 PM, wren ng thornton <wren at freegeek.org> wrote:
>> They don't?  I am pretty sure that a floating point number is always equal
>> to itself, with possibly a strange corner case for things like +/- 0 and
>> NaN.
> Exactly. NaN /= NaN.
> Other than that, I believe that "let x = ... in x == x" is true (because
> they are the same bitfield by definition), however it is easy to have 'the
> same number' without it having the same bitfield representation due to loss
> of precision and the like. To say nothing of failures of other laws leading
> to overflow, underflow, etc.

Indeed. NaN means that equality is not reflexive for floats in
general, only a subset of them.

Likewise, addition and multiplication are not associative and the
distributive law doesn't hold.

I think commutativity is retained, though. That's something, right?

- C.

More information about the Haskell-Cafe mailing list