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

Method check

numpy/core/tests/test_umath.py:4218–4239  ·  view source on GitHub ↗
(x, rtol)

Source from the content-addressed store, hash-verified

4216 eps = info.eps
4217
4218 def check(x, rtol):
4219 x = x.astype(real_dtype)
4220
4221 z = x.astype(dtype)
4222 d = np.absolute(np.arcsinh(x)/np.arcsinh(z).real - 1)
4223 assert_(np.all(d < rtol), (np.argmax(d), x[np.argmax(d)], d.max(),
4224 'arcsinh'))
4225
4226 z = (1j*x).astype(dtype)
4227 d = np.absolute(np.arcsinh(x)/np.arcsin(z).imag - 1)
4228 assert_(np.all(d < rtol), (np.argmax(d), x[np.argmax(d)], d.max(),
4229 'arcsin'))
4230
4231 z = x.astype(dtype)
4232 d = np.absolute(np.arctanh(x)/np.arctanh(z).real - 1)
4233 assert_(np.all(d < rtol), (np.argmax(d), x[np.argmax(d)], d.max(),
4234 'arctanh'))
4235
4236 z = (1j*x).astype(dtype)
4237 d = np.absolute(np.arctanh(x)/np.arctan(z).imag - 1)
4238 assert_(np.all(d < rtol), (np.argmax(d), x[np.argmax(d)], d.max(),
4239 'arctan'))
4240
4241 # The switchover was chosen as 1e-3; hence there can be up to
4242 # ~eps/1e-3 of relative cancellation error before it

Callers

nothing calls this directly

Calls 7

assert_Function · 0.90
absFunction · 0.85
astypeMethod · 0.80
funcFunction · 0.50
allMethod · 0.45
argmaxMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected