The OpenD Programming Language

ceilLog10Exp2

Fast integer computation of ceil(log10(exp2(e))) with 64-bit mantissa precision. The result is guaranted to be greater then log10(exp2(e)), which is irrational number.

@safe pure nothrow @nogc
T
ceilLog10Exp2
(
T
)
(
const T e
)
if (
is(T == ubyte) ||
is(T == ushort)
||
is(T == uint)
||
is(T == ulong)
)

Examples

assert(ceilLog10Exp2(ubyte(10)) == 4); // ubyte
assert(ceilLog10Exp2(10U) == 4); // uint
assert(ceilLog10Exp2(10UL) == 4); // ulong

Meta