MCPcopy Create free account
hub / github.com/numpy/numpy / test_complex64_pass

Method test_complex64_pass

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

Source from the content-addressed store, hash-verified

1112 xi, y + y*1j, nulp)
1113
1114 def test_complex64_pass(self):
1115 nulp = 5
1116 x = np.linspace(-20, 20, 50, dtype=np.float32)
1117 x = 10**x
1118 x = np.r_[-x, x]
1119 xi = x + x*1j
1120
1121 eps = np.finfo(x.dtype).eps
1122 y = x + x*eps*nulp/2.
1123 assert_array_almost_equal_nulp(xi, x + y*1j, nulp)
1124 assert_array_almost_equal_nulp(xi, y + x*1j, nulp)
1125 y = x + x*eps*nulp/4.
1126 assert_array_almost_equal_nulp(xi, y + y*1j, nulp)
1127
1128 epsneg = np.finfo(x.dtype).epsneg
1129 y = x - x*epsneg*nulp/2.
1130 assert_array_almost_equal_nulp(xi, x + y*1j, nulp)
1131 assert_array_almost_equal_nulp(xi, y + x*1j, nulp)
1132 y = x - x*epsneg*nulp/4.
1133 assert_array_almost_equal_nulp(xi, y + y*1j, nulp)
1134
1135 def test_complex64_fail(self):
1136 nulp = 5

Callers

nothing calls this directly

Calls 2

linspaceMethod · 0.80

Tested by

no test coverage detected