Mark Dickinson added the comment:

This is not a bug, but a known and difficult-to-avoid issue with signed zeros 
and creating complex numbers from real and imaginary parts.  The safe way to do 
it is to use the `complex(real_part, imag_part)` construction.

In the first example, you're subtracting a complex number (0.j) from a float 
(-0.0).  The float gets promoted to a complex (by filling in an imaginary part 
of +0.0), and the imaginary literal is similarly treated as a complex number 
(by filling  in a 0.0 for the real part).  So the subtraction is doing:

  complex(-0.0, 0.0) - complex(0.0, -0.0)

which as expected gives a real part of -0.0, and an imaginary part of +0.0.

----------
resolution:  -> not a bug
status: open -> closed

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

Reply via email to