| 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 |