math.magnitude(): return order of magnitude of a number
This commit is contained in:
parent
24cd561370
commit
dd39c90f13
@ -26,3 +26,7 @@ def mul(ints: Iterable[int]) -> int:
|
||||
ret *= x
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def magnitude(value: int | float) -> int:
|
||||
return math.floor(math.log10(value))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user