Commits

mattip committed f41eea1

test, fix c_div for nan in denom

Comments (0)

Files changed (2)

pypy/rlib/rcomplex.py

             denom = r2 + i2 * ratio
             rr = (r1 + i1 * ratio) / denom
             ir = (i1 - r1 * ratio) / denom
+    elif isnan(r2):
+        rr = NAN
+        ir = NAN
     else:
         ratio = r2 / i2
         denom = r2 * ratio + i2

pypy/rlib/test/test_rcomplex.py

         ]:
             assert c.c_mul(c1, c2) == result
 
+def test_div():
+    c.c_div((2., 3.), (float('nan'), 0.)) == (float('nan'), float('nan'))
+
 def parse_testfile2(fname):
     """Parse a file with test values