Return True if *x* is an integer power of *base*.
(x, *, base=10, rtol=None)
| 2330 | |
| 2331 | |
| 2332 | def _is_decade(x, *, base=10, rtol=None): |
| 2333 | """Return True if *x* is an integer power of *base*.""" |
| 2334 | if not np.isfinite(x): |
| 2335 | return False |
| 2336 | if x == 0.0: |
| 2337 | return True |
| 2338 | lx = np.log(abs(x)) / np.log(base) |
| 2339 | if rtol is None: |
| 2340 | return np.isclose(lx, np.round(lx)) |
| 2341 | else: |
| 2342 | return np.isclose(lx, np.round(lx), rtol=rtol) |
| 2343 | |
| 2344 | |
| 2345 | def _decade_less_equal(x, base): |