[Python-Dev] test_coercion failing
Jack Jansen
jack@oratrix.nl
Wed, 21 Mar 2001 14:30:32 +0100
It turns out that even simple things like 0j/2 return -0.0.
The culprit appears to be the statement
r.imag = (a.imag - a.real*ratio) / denom;
in c_quot(), line 108.
The inner part is translated into a PPC multiply-subtract instruction
fnmsub fp0, fp1, fp31, fp0
Or, in other words, this computes "0.0 - (2.0 * 0.0)". The result of this is
apparently -0.0. This sounds reasonable to me, or is this against IEEE754
rules (or C99 rules?).
If this is all according to 754 rules the one puzzle remaining is why other
754 platforms don't see the same thing. Could it be that the combined
multiply-subtract skips a rounding step that separate multiply and subtract
instructions would take? My floating point knowledge is pretty basic, so
please enlighten me....
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm