On Sat, 28 May 2011 23:12:54 -0700, John Nagle wrote: > The correct answer to "nan == nan" is to raise an exception, because > you have asked a question for which the answer is nether True nor False.
Wrong. The correct answer to "nan == nan" is False, they are not equal. Just as None != "none", and 42 != [42], or a teacup is not equal to a box of hammers. Asking whether NAN < 0 could arguably either return "unordered" (raise an exception) or return False ("no, NAN is not less than zero; neither is it greater than zero"). The PowerPC Macintishes back in the 1990s supported both behaviours. But that's different to equality tests. > The correct semantics for IEEE floating point look something like > this: > > 1/0 INF > INF + 1 INF > INF - INF NaN > INF == INF unordered Wrong. Equality is not an order comparison. -- Steven -- http://mail.python.org/mailman/listinfo/python-list