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

Method test_complex64_pass

numpy/testing/tests/test_utils.py:1585–1604  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1583 xi, y + y * 1j, nulp)
1584
1585 def test_complex64_pass(self):
1586 nulp = 5
1587 x = np.linspace(-20, 20, 50, dtype=np.float32)
1588 x = 10**x
1589 x = np.r_[-x, x]
1590 xi = x + x * 1j
1591
1592 eps = np.finfo(x.dtype).eps
1593 y = x + x * eps * nulp / 2.
1594 assert_array_almost_equal_nulp(xi, x + y * 1j, nulp)
1595 assert_array_almost_equal_nulp(xi, y + x * 1j, nulp)
1596 y = x + x * eps * nulp / 4.
1597 assert_array_almost_equal_nulp(xi, y + y * 1j, nulp)
1598
1599 epsneg = np.finfo(x.dtype).epsneg
1600 y = x - x * epsneg * nulp / 2.
1601 assert_array_almost_equal_nulp(xi, x + y * 1j, nulp)
1602 assert_array_almost_equal_nulp(xi, y + x * 1j, nulp)
1603 y = x - x * epsneg * nulp / 4.
1604 assert_array_almost_equal_nulp(xi, y + y * 1j, nulp)
1605
1606 def test_complex64_fail(self):
1607 nulp = 5

Callers

nothing calls this directly

Calls 2

linspaceMethod · 0.80

Tested by

no test coverage detected