Open
Description
For example,
>>> z1 = complex(1,+0.0)
>>> z1**2
(1+0j)
>>> z1*z1
(1+0j)
>>> z2 = complex(1,-0.0)
>>> z2**2
(1+0j)
>>> z2*z2
(1-0j)
"Big enough" or non-integer powers are unaffected:
>>> z2**2000
(1-0j)
>>> z2**2.1
(1-0j)
It seems, this is related to
cpython/Objects/complexobject.c
Line 164 in c179c0e
Instead, imaginary component of
r
should copy the sign from x.imag
.