Signed zeros: is this a bug?
dickinsm at gmail.com
Sun Mar 11 18:44:34 CET 2007
On Mar 11, 1:26 pm, a... at mac.com (Alex Martelli) wrote:
> [Long analysis of probable cause of the problem]
Thank you for this. I was suspecting something along these lines,
but I don't yet know my way around the source well enough to figure
out where the problem was coming from.
> In the meantime, I hope that some available workarounds for the bug are
> clear from this discussion: avoid using multiple constants in a single
> compilation unit where one is 0.0 and another is -0.0, or, if you really
> can't avoid that, perhaps use compiler.compile to explicitly build the
> bytecode you need.
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
>>> x, y = -(0.0), 0.0
>>> x, y
More information about the Python-list