Re: Signed zeros: is this a bug?
- From: "Dan Bishop" <danb_83@xxxxxxxxx>
- Date: 11 Mar 2007 09:04:51 -0700
On Mar 11, 9:31 am, "Mark Dickinson" <dicki...@xxxxxxxxx> wrote:
I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC,
in case it's relevant.)
(0.0, 0.0)x, y = 0.0, -0.0
x, y
x, y = -0.0, 0.0
x, y
(-0.0, -0.0)
I would have expected y to be -0.0 in the first case, and 0.0 in the
second. Should the above be considered a bug, or is Python not
expected to honour signs of zeros? I'm working in a situation
involving complex arithmetic where branch cuts, and hence signed
zeros, are important, and it would be handy if the above code could be
relied upon to do the right thing.
IIRC, float.__repr__ just does whatever libc does. Have you tried
using printf("%g, %g", 0.0, -0.0) in a C program?
.
- Follow-Ups:
- Re: Signed zeros: is this a bug?
- From: Terry Reedy
- Re: Signed zeros: is this a bug?
- References:
- Signed zeros: is this a bug?
- From: Mark Dickinson
- Signed zeros: is this a bug?
- Prev by Date: Re: Signed zeros: is this a bug?
- Next by Date: Re: PIL: reading bytes from Image
- Previous by thread: Re: Signed zeros: is this a bug?
- Next by thread: Re: Signed zeros: is this a bug?
- Index(es):