Issue #1678380. Fix a bug that identifies 0j and -0j when they appear

in the same code unit. The fix is essentially the same as the fix for a
previous bug identifying 0. and -0.
This commit is contained in:
Mark Dickinson 2008-01-31 22:17:37 +00:00
parent 2df20a3e08
commit 105be7725b
3 changed files with 57 additions and 12 deletions

View file

@ -359,6 +359,13 @@ class ComplexTest(unittest.TestCase):
except (OSError, IOError):
pass
if float.__getformat__("double").startswith("IEEE"):
def test_plus_minus_0j(self):
# test that -0j and 0j literals are not identified
z1, z2 = 0j, -0j
self.assertEquals(atan2(z1.imag, -1.), atan2(0., -1.))
self.assertEquals(atan2(z2.imag, -1.), atan2(-0., -1.))
def test_main():
test_support.run_unittest(ComplexTest)