On Thu, Apr 8, 2010 at 7:58 PM, wren ng thornton <w...@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. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe