Signed zeros: is this a bug?

Alex Martelli aleax at mac.com
Sun Mar 11 14:59:53 EDT 2007


Alex Martelli <aleax at mac.com> wrote:
   ...
> > Yup: the workaround seems to be as simple as replacing all occurrences
> > of -0.0 with -(0.0).  I'm embarrassed that I didn't figure this out
> > sooner.
> > 
> > >>> x, y = -(0.0), 0.0
> > >>> x, y
> > (-0.0, 0.0)
> 
> Glad it works for you, but it's the kind of workaround that could break
> with any minor tweak/optimization to the compiler... very fragile:-(.

OTOH, Python 2.4 works just fine...:

Python 2.4.3 (#1, Apr  7 2006, 10:54:33) 
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 0.0,-0.0
(0.0, -0.0)
>>> -0.0,0.0
(-0.0, 0.0)

so it seems to be very specifically a 2.5 problem.


Alex



More information about the Python-list mailing list