[Python-Dev] Caching float(0.0)

"Martin v. Löwis" martin at v.loewis.de
Tue Oct 3 19:27:05 CEST 2006


Nicko van Someren schrieb:
> It's only a semantic change on platforms that "happen to" use IEEE  
> 754 float representations, or some other representation that exposes  
> the sign of zero.

Right. Later, you admit that this is vast majority of modern machines.

> It would be instructive to understand how much, if any, python code  
> would break if we lost -0.0.  I'm do not believe that there is any  
> reliable way for python code to tell the difference between all of  
> the different types of IEEE 754 zeros and in the special case of -0.0  
> the best test I can come up with is repr(n)[0]=='-'.  Is there an  
> compelling case, to do with compatibility or otherwise, for exposing  
> the sign of a zero?  It seems like a numerical anomaly to me.

I think it is reasonable to admit that
a) this change is a change in semantics for the majority of the
   machines
b) it is likely that this change won't affect a significant number
   of applications (I'm pretty sure someone will notice, though;
   someone always notices).

Regards,
Martin


More information about the Python-Dev mailing list