Fix utils.ceil_log with invalid log values
This commit is contained in:
parent
ca7c53d4df
commit
5840b60967
@ -719,6 +719,8 @@ def ceil_log(number, base):
|
|||||||
|
|
||||||
Use only integer arithmetic in order to avoid numerical error.
|
Use only integer arithmetic in order to avoid numerical error.
|
||||||
"""
|
"""
|
||||||
|
if number < 1 or base < 2:
|
||||||
|
raise ValueError("math domain error")
|
||||||
result = 1
|
result = 1
|
||||||
accum = base
|
accum = base
|
||||||
while accum < number:
|
while accum < number:
|
||||||
|
Loading…
Reference in New Issue
Block a user