ilog10
ilog10(
n):number
Defined in: packages/core/src/number/integer/ilog10.ts:21
Floor of log₁₀ for a positive integer number value.
Backward-scans the powers of ten below Number.MAX_SAFE_INTEGER — O(19) =
O(1).
Parameters
Section titled “Parameters”number
Must satisfy n >= 1; negative / zero / non-integer input is
undefined behaviour.
Returns
Section titled “Returns”number
Floor of log₁₀(n), i.e. the number of decimal digits minus one.
Example
Section titled “Example” ilog10(1); // → 0 ilog10(9); // → 0 ilog10(10); // → 1 ilog10(999); // → 2 ```;