Signed zeros: is this a bug?

Alex Martelli aleax at mac.com
Sun Mar 11 21:56:08 EDT 2007


Tim Peters <tim.one 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 

Please take a look at my patch 1678668, brand new at
<http://sourceforge.net/tracker/index.php> and as yet unassigned (hint,
hint:-).

I hope it satisfies your very reasonable lament about the bug
resurfacing once in a while, since it included one more unittest to
check whether the bug is there (TDD rocks!-), based exactly on the
behavior of atan2 (only on IEEE-format machines, though).

> 2.5 introduced a new front end and more ambitious constant-folding, and
> I expect the bug showed up again due to one of those.

Yep, in ast.c's ast_for_factor -- it lacks the specialcasing that
peephole.c does have (and my patch essentially adds it back).

If it's worth specialcasing in peephole.c (and I strongly agree with
Raymond's implicit opinion that it is), it should be just as worth
specialcasing in ast.c, no?-)


Alex



More information about the Python-list mailing list