MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _is_decade

Function _is_decade

lib/matplotlib/ticker.py:2332–2342  ·  view source on GitHub ↗

Return True if *x* is an integer power of *base*.

(x, *, base=10, rtol=None)

Source from the content-addressed store, hash-verified

2330
2331
2332def _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
2345def _decade_less_equal(x, base):

Callers 2

set_locsMethod · 0.85
__call__Method · 0.85

Calls 1

iscloseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…