[New-bugs-announce] [issue17336] Complex number representation round-trip doesn't work with signed zero values

Manuel Jacob report at bugs.python.org
Sat Mar 2 12:28:04 CET 2013


New submission from Manuel Jacob:

When evaluating, signed zero complex numbers aren't recovered correctly.
>>> -0j
(-0-0j)
>>> (-0-0j)
0j
>>> 0j
0j

According to http://docs.python.org/dev/reference/datamodel.html#object.__repr__ the representation can be used to recreate an object with the same value. Shouldn't this also be possible with complex numbers?

When using complex('...'), round-trip works correctly. While this can be used to recover the exact number, i find it confusing that complex('...') isn't the same as eval('...').
>>> complex('-0j')
-0j
>>> complex('(-0-0j)')
(-0-0j)
>>> complex('0j')
0j

----------
messages: 183313
nosy: mjacob
priority: normal
severity: normal
status: open
title: Complex number representation round-trip doesn't work with signed zero values
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17336>
_______________________________________


More information about the New-bugs-announce mailing list