[issue6646] test_pickle fails on AIX -- 6.9999999999999994e-308 != 6.9999999999999984e-308
Mark Dickinson
report at bugs.python.org
Thu Aug 6 22:10:19 CEST 2009
Mark Dickinson <dickinsm at gmail.com> added the comment:
Thanks. So pickle protocol 0 is where it's failing; protocols 1 and 2
are okay. It looks as though there's a problem with double <-> string
(i.e., binary <-> decimal) conversion here.
This probably also means that there are more serious problems on AIX,
e.g., that float(repr(x)) == x fails for at least some Python floats x.
That is, on my system:
>>> x = 7e-308
>>> float(repr(x)) == x
True
I expect that you'd get 'False' for this. Is that right? If you do get
False, does this happen for any randomly chosen float x, or is it just
very small values like the above that are problematic?
Is there any chance the FPU rounding mode has somehow been set to
something other than round-to-nearest? (It seems unlikely, but it's
worth checking.)
These bits of Python are based on the assumption that conversion of an
IEEE 754-format C double to a decimal string with 17 significant digits
and back again recovers the original double. A conforming hosted
implementation of C99 that defines __STDC_IEC_559__ should satisfy this
assumption (see Appendix F of the standard, especially section F.5);
the IEEE 754 standard also recommends this behaviour.
So if your C implementation defines __STDC_IEC_559__ then this can
reasonably be considered a platform bug. Does it?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6646>
_______________________________________
More information about the Python-bugs-list
mailing list