List Info

Thread: Floating point test_pow failure on the alpha Debian buildbot




Floating point test_pow failure on the alpha Debian buildbot
user name
2007-07-26 09:08:30
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.

Cheers,
Nick.




-- 
Nick Coghlan   |   ncoghlangmail.com   |   Brisbane,
Australia
------------------------------------------------------------
---
             http://www.boredoma
ndlaziness.org
_______________________________________________
Python-Dev mailing list
Python-Devpython.org
ht
tp://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/p
ython-dev/nessto%40sharedlog.com

Re: Floating point test_pow failure on the alpha Debian buildbot
user name
2007-07-26 10:34:02
[Nick Coghlan]
> 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

It is wrong -- the machine representation of test_pow's
1.23e167
literal is an exact integer on any current box, and the
floor of any
exact integer is the integer itself.

> (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.

This isn't Python's problem -- a bug report should be opened
against
the platform C's implementation of floor(), and the test
/should/ fail
in Python so long as the platform floor() remains broken.
_______________________________________________
Python-Dev mailing list
Python-Devpython.org
ht
tp://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/p
ython-dev/nessto%40sharedlog.com

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )