New submission from Eric Wieser <wieser.e...@gmail.com>:

Python distinguishes signed zeros by their repr:

# floats
>>> 0.0
0.0
>>> -0.0
-0.0

# complex
>>> complex(0.0, 0.0)  # A
0j
>>> complex(0.0, -0.0)  # B
-0j
>>> complex(-0.0, 0.0)  # C
(-0+0j)
>>> complex(-0.0, -0.0)  # D
(-0+0j)

However, only one of these `complex` reprs round-trips:

>>> 0j   # ok
0j
>>> -0j   # doesn't round-trip
(-0-0j)
>>> (-0+0j)  # doesn't round-trip
0j
>>> (-0-0j)
0j

----------
components: Interpreter Core
messages: 374864
nosy: Eric Wieser
priority: normal
severity: normal
status: open
title: Repr of complex number with signed zero does not roundtrip
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41485>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to