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