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

Method check

numpy/_core/tests/test_umath.py:4559–4580  ·  view source on GitHub ↗
(x, rtol)

Source from the content-addressed store, hash-verified

4557 eps = info.eps
4558
4559 def check(x, rtol):
4560 x = x.astype(real_dtype)
4561
4562 z = x.astype(dtype)
4563 d = np.absolute(np.arcsinh(x) / np.arcsinh(z).real - 1)
4564 assert_(np.all(d < rtol), (np.argmax(d), x[np.argmax(d)], d.max(),
4565 'arcsinh'))
4566
4567 z = (1j * x).astype(dtype)
4568 d = np.absolute(np.arcsinh(x) / np.arcsin(z).imag - 1)
4569 assert_(np.all(d < rtol), (np.argmax(d), x[np.argmax(d)], d.max(),
4570 'arcsin'))
4571
4572 z = x.astype(dtype)
4573 d = np.absolute(np.arctanh(x) / np.arctanh(z).real - 1)
4574 assert_(np.all(d < rtol), (np.argmax(d), x[np.argmax(d)], d.max(),
4575 'arctanh'))
4576
4577 z = (1j * x).astype(dtype)
4578 d = np.absolute(np.arctanh(x) / np.arctan(z).imag - 1)
4579 assert_(np.all(d < rtol), (np.argmax(d), x[np.argmax(d)], d.max(),
4580 'arctan'))
4581
4582 # The switchover was chosen as 1e-3; hence there can be up to
4583 # ~eps/1e-3 of relative cancellation error before it

Callers

nothing calls this directly

Calls 6

assert_Function · 0.90
astypeMethod · 0.80
funcFunction · 0.70
allMethod · 0.45
argmaxMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected