math.magnitude(): return order of magnitude of a number

This commit is contained in:
Stefan Harmuth 2024-12-07 06:35:55 +01:00
parent 24cd561370
commit dd39c90f13

View File

@ -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))