MCPcopy Index your code
hub / github.com/numpy/numpy / test_signed_zeros

Method test_signed_zeros

numpy/_core/tests/test_scalarmath.py:428–451  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

426 assert_(np.isnan(b / a))
427
428 def test_signed_zeros(self):
429 with np.errstate(all="ignore"):
430 for t in [np.complex64, np.complex128]:
431 # tupled (numerator, denominator, expected)
432 # for testing as expected == numerator/denominator
433 data = (
434 (( 0.0, -1.0), ( 0.0, 1.0), (-1.0, -0.0)),
435 (( 0.0, -1.0), ( 0.0, -1.0), ( 1.0, -0.0)),
436 (( 0.0, -1.0), (-0.0, -1.0), ( 1.0, 0.0)),
437 (( 0.0, -1.0), (-0.0, 1.0), (-1.0, 0.0)),
438 (( 0.0, 1.0), ( 0.0, -1.0), (-1.0, 0.0)),
439 (( 0.0, -1.0), ( 0.0, -1.0), ( 1.0, -0.0)),
440 ((-0.0, -1.0), ( 0.0, -1.0), ( 1.0, -0.0)),
441 ((-0.0, 1.0), ( 0.0, -1.0), (-1.0, -0.0))
442 )
443 for cases in data:
444 n = cases[0]
445 d = cases[1]
446 ex = cases[2]
447 result = t(complex(n[0], n[1])) / t(complex(d[0], d[1]))
448 # check real and imag parts separately to avoid comparison
449 # in array context, which does not account for signed zeros
450 assert_equal(result.real, ex[0])
451 assert_equal(result.imag, ex[1])
452
453 def test_branches(self):
454 with np.errstate(all="ignore"):

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
tFunction · 0.85

Tested by

no test coverage detected