MCPcopy Index your code
hub / github.com/python/cpython / _log10_lb

Function _log10_lb

Lib/_pydecimal.py:5983–5990  ·  view source on GitHub ↗

Compute a lower bound for 100*log10(c) for a positive integer c.

(c, correction = {
        '1': 100, '2': 70, '3': 53, '4': 40, '5': 31,
        '6': 23, '7': 16, '8': 10, '9': 5})

Source from the content-addressed store, hash-verified

5981 return coeff, exp
5982
5983def _log10_lb(c, correction = {
5984 '1': 100, '2': 70, '3': 53, '4': 40, '5': 31,
5985 '6': 23, '7': 16, '8': 10, '9': 5}):
5986 """Compute a lower bound for 100*log10(c) for a positive integer c."""
5987 if c <= 0:
5988 raise ValueError("The argument to _log10_lb should be nonnegative.")
5989 str_c = str(c)
5990 return 100*len(str_c) - correction[str_c[0]]
5991
5992##### Helper Functions ####################################################
5993

Callers 1

_power_exactMethod · 0.85

Calls 1

strFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…