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