Addition/subtraction clear sign from signed 0j · Issue #107854 · python/cpython (original) (raw)
Complex numbers with signed zero as an imaginary part could be created from a string or with two-argument form of the complex() constructor:
complex(1.0, -0.0) (1-0j) complex('(1-0j)') (1-0j)
It's also possible to create pure imaginary numbers with signed zero:
-0j # or it should be complex(0.0,-0.0)? (-0-0j)
But it's impossible to create a complex number with signed zero as an imaginary part if addition/subtraction is used (i.e. adding a real number and an imaginary number):
1-0j # should be complex(1.0,-0.0) (1+0j) 1+(-0j) # ditto here (1+0j) 0-0j # should be complex(0.0,-0.0) 0j