integer-log10 ( x -- n )
Factor handbook » The language » Numbers » Mathematical functions » Integer functions

Prev:integer-log2 ( x -- n )
Next:integer-sqrt ( x -- n )


Vocabulary
math.functions

Inputs
xa positive rational number


Outputs
nan integer


Word description
Outputs the largest integer n such that 10^n is less than or equal to x.

Errors
Throws an error if x is zero or negative.

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


Definition