PARTIAL SOLUTION: Compiling Python 2.2 with GCC in HPUX 10.20 does not work

Tim Peters tim.one at comcast.net
Fri Mar 8 15:58:27 EST 2002


[Michael Piotrowski]
> I've had a look at test_fpformat: The test expects that
>
>    "%.*f" % (0, -0.003)
>
> produces -0 (negative zero),

No, and this is important:  this has nothing to do with negative zeroes.
What the test expects is a two-character *string*, '-' followed by '0'.

> but on HP-UX 10.20, this yields 0.  It seems that, according to IEEE,
> -0 would be correct, and this is indeed what you get on HP-UX 11.

IEEE-754 is irrelevant to this test.  It's the C standard that defines the
result here, and IEEE rules have nothing to do with it.  -0.003 is a
non-zero negative number.  IEEE esoterica would get involved only if the
test had been

    "%.*f" % (0, -0.0)

instead.  But the Python test suite stays away from stuff like that,
precisely because the C standard doesn't say anything about signed zeroes.

> This is basically a, ahem, property of the 10.20 libc; I don't think
> there's anything reasonable one could do about it.  Also, apart from
> the test, I'd think that this has any impact on Python.  If you need
> the "correct" behavior, the best idea might be to upgrade to 11.
>
> You might also want to have a look at
>
> <http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x3f0ecb60e503d611
> 8ff40090279cd0f9,00.html>
>
> According to this posting, Solaris 7 and AIX 4.3 seem to behave in the
> same way as HP-UX 10.20, so test_fpformat should fail on these
> platforms, too.

That link is again about IEEE signed zeroes, and test_fpformat doesn't use
signed zeroes.





More information about the Python-list mailing list