fastLog10

Undocumented in source. Be warned that the author may not have intended to support it.
  1. uint fastLog10(uint val)
    @safe pure nothrow @safe @nogc
    uint
    fastLog10
    (
    const uint val
    )
  2. uint fastLog10(ulong val)

Examples

assert(fastLog10(1) == 0);
assert(fastLog10(9) == 0);
assert(fastLog10(11) == 1);
assert(fastLog10(99) == 1);
assert(fastLog10(111) == 2);
assert(fastLog10(999) == 2);
assert(fastLog10(1_111) == 3);
assert(fastLog10(9_999) == 3);
assert(fastLog10(11_111) == 4);
assert(fastLog10(99_999) == 4);
assert(fastLog10(999_999_999) == 8);
assert(fastLog10(1_000_000_000) == 9);
assert(fastLog10(uint.max) == 9);

Meta