Mark Dickinson <dicki...@gmail.com> added the comment: Thanks for the details. So the relevant code (see the float_hex function in Objects/floatobject.c) looks like this:
if (x == 0.0) { if(copysign(1.0, x) == -1.0) return PyString_FromString("-0x0.0p+0"); else return PyString_FromString("0x0.0p+0"); } This *should* produce the correct string for -0.0 (because -0.0 compares equal to 0.0, and then copysign(1.0, x) should be -1.0); I'm reasonably confident that the C code is correct, since the tests pass on all the other platforms that get tested regularly. So a buggy system copysign function looks like a possibility. Another more likely possibility occurs to me, though: and that's that there's a buggy compiler optimization going on: the compiler sees that we're in an 'x == 0.0' branch, and decides that it can substitute '0.0' for 'x' everywhere in the 'if' block. But this is just guessing. Do you still get these failures in a debug build of Python (i.e., by passing --with-pydebug to the configure script)? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9069> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com