[issue11949] Make float('nan') unorderable

Mark Dickinson report at bugs.python.org
Sat May 14 20:50:33 CEST 2011


Mark Dickinson <dickinsm at gmail.com> added the comment:

It seems we're getting a bit off-topic for the issue title;  the discussion about cleaning up test_math (which I agree would be a good thing to do) should probably go into another issue.

On the issue itself, I'm -1 on making comparisons with float('nan') raise: I don't see that there's a real problem here that needs solving.  

Note that the current behaviour does *not* violate IEEE 754, since there's nothing anywhere in IEEE 754 that says that Python's < operation should raise for comparisons involving NaNs:  all that's said is that a conforming language should provide a number of comparison operations (without specifying how those operation should be spelt in the language in question), including both a < operation that's quiet (returning a false value for comparison with NaNs) and a < operation that signals on comparison with NaN.  There's nothing to indicate definitively which of these two operations '<' should bind to in a language.

It *is* true that C chooses to bind '<' to the signalling version, but that doesn't automatically mean that we should do the same in Python.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11949>
_______________________________________


More information about the Python-bugs-list mailing list