The math.functions.integer-logs vocabulary provides exact integer logarithms for all rational numbers:
integer-log2 ( x -- n )

integer-log10 ( x -- n )


Examples
USING: prettyprint math.functions.integer-logs sequences ; { 5 99 100 101 100000000000000000000 100+1/2 1/100 } [ integer-log10 ] map .
{ 0 1 2 2 20 2 -2 }