Signed zeros: is this a bug?

Mark Dickinson dickinsm at gmail.com
Sun Mar 11 22:29:48 CET 2007


On Mar 11, 5:15 pm, Tim Peters <tim.... at comcast.net> wrote:
 It's a bug that keeps resurfacing, probably because there's no
portable
> way to test that it stays fixed :-( (it's not an accident that the OP
> relied on atan2 to distinguish +0.0 from -0.0!  they act the same in
> /almost/ all contexts).

Not an accident, but not a contrived example either.  I'd rewritten
all the cmath routines (in pure Python) to be more numerically aware
and use the
`correct' (= those recommended by Kahan) branch cuts.  It was in
writing the unit tests for this that the problems above surfaced.

By the way, I don't suppose that anybody would be interested in
a rewritten cmath for Python 2.6?  It wouldn't be hard for me to
rewrite what I already have in C, and add suitable documentation
and tests.

Mark




More information about the Python-list mailing list