]> granicus.if.org Git - python/commit
SF bug #513866: Float/long comparison anomaly.
authorTim Peters <tim.peters@gmail.com>
Thu, 23 Sep 2004 08:06:40 +0000 (08:06 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 23 Sep 2004 08:06:40 +0000 (08:06 +0000)
commit307fa78107c39ffda1eb4ad18201d25650354c4e
tree6b2daf6dc3169cfc2054ebc4162647b5c647d875
parent4533f1fb7fbf1fa8a9cb264ff6f1f0aba043e80d
SF bug #513866:  Float/long comparison anomaly.

When an integer is compared to a float now, the int isn't coerced to float.
This avoids spurious overflow exceptions and insane results.  This should
compute correct results, without raising spurious exceptions, in all cases
now -- although I expect that what happens when an int/long is compared to
a NaN is still a platform accident.

Note that we had potential problems here even with "short" ints, on boxes
where sizeof(long)==8.  There's #ifdef'ed code here to handle that, but
I can't test it as intended.  I tested it by changing the #ifdef to
trigger on my 32-bit box instead.

I suppose this is a bugfix candidate, but I won't backport it.  It's
long-winded (for speed) and messy (because the problem is messy).  Note
that this also depends on a previous 2.4 patch that introduced
_Py_SwappedOp[] as an extern.
Lib/test/test_long.py
Misc/NEWS
Objects/floatobject.c