PEP 238 (revised)

Bengt Richter bokr at accessone.com
Sat Jul 28 21:43:13 EDT 2001


On Sat, 28 Jul 2001 16:29:18 -0400, "Tim Peters" <tim.one at home.com> wrote:

>[Tim]
>> > Multiplying by 1.0 preserves the sign of a 754 zero, but adding 0.0
>> > (of either sign) may not;
>
My intel pentium book is plainly wrong, ignore previous doubt about *1.0 ;-)
 >>> math.atan2( 0.0,-0.0*1.0)
 3.1415926535897931
 >>> math.atan2( 0.0, 0.0*1.0)
 0.0

>[Marcin 'Qrczak' Kowalczyk]
>> Why adding a negative zero may not? If 0.0+(-0.0) is specified to be
>> 0.0, then I don't see where it breaks.
>
>The result of 0+(-0) is -0 in the to-minus-inf rounding mode.  The result of
>multiplying by 1.0 is independent of rounding mode.
>
>obviously-correct-is-better-than-subtly-broken-ly y'rs  - tim
>
>




More information about the Python-list mailing list