fastLog10

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

Examples

assert(fastLog10(1UL) == 0);
assert(fastLog10(9UL) == 0);
assert(fastLog10(11UL) == 1);
assert(fastLog10(99UL) == 1);
/+ TODO: assert(fastLog10(111UL) == 2); +/
assert(fastLog10(999UL) == 2);
assert(fastLog10(1_111UL) == 3);
assert(fastLog10(9_999UL) == 3);
assert(fastLog10(11_111UL) == 4);
assert(fastLog10(99_999UL) == 4);
assert(fastLog10(999_999_999UL) == 8);
assert(fastLog10(1_000_000_000UL) == 9);
assert(fastLog10(10_000_000_000UL) == 10);
assert(fastLog10(100_000_000_000UL) == 11);
assert(fastLog10(1_000_000_000_000UL) == 12);
assert(fastLog10(10_000_000_000_000UL) == 13);
assert(fastLog10(100_000_000_000_000UL) == 14);
assert(fastLog10(1_000_000_000_000_000UL) == 15);
assert(fastLog10(10_000_000_000_000_000UL) == 16);
assert(fastLog10(100_000_000_000_000_000UL) == 17);
assert(fastLog10(1_000_000_000_000_000_000UL) == 18);
assert(fastLog10(10_000_000_000_000_000_000UL) == 19);

Meta