[Python-Dev] Floating point test_pow failure on the alpha Debian buildbot

Nick Coghlan ncoghlan at gmail.com
Thu Jul 26 16:08:30 CEST 2007

test_pow is failing on the alpha Debian buildbot, complaining that a 
negative number can't be raised to a fractional power. Now, to work 
around some bugs in platform implementations of math.fpow(), pow() does 
its own check to see if the exponent is an integer.

The way pow() does that check is to try "iw == floor(iw)", so to see why 
the exception was being triggered, I put a couple of extra output lines 
into the test and got:

*** Number: 1.2299999999999999e+167
*** Floor: 1.2299999999999997e+167

Given that the magnitude of the exponent significantly exceeds the 
precision of an IEEE double, it seems wrong for floor() to be changing 
the mantissa like that (and, on my machine, and all of the other 
buildbots, it doesn't).

I've added an explicit test for this misbehaviour to test_math so at 
least the buildbot gives a clearer indication of what's going wrong, but 
I'm not sure what to do with it beyond that.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list