Sept. 23, 2004
9:45 a.m.
Hello Tim, Your float.richcompare patch, trying to map the C semantics at the Python level, introduces artificial results when comparing NaN's with longs:
float('nan') > 0 False float('nan') > 0L True
I am not aware of all the problems and various platforms, but clearly in the patch 'vsign' by itself doesn't make much sense if 'v' is a NaN. Wouldn't all compilers and platforms compare NaNs "strangely", for some detectable definition of "stange"? Something along the lines of: #define Py_IS_NAN(v) (!Py_IS_INFINITY(v) && \ ( ((v) < 0.0 && (v) > 0.0) || \ !((v) < 1.0 || (v) > -1.0) ) Armin