up previous next
FloorLog2, FloorLog10, FloorLogBase

integer part of the logarithm

Syntax
FloorLog2(X: RAT): INT
FloorLog10(X: RAT): INT
FloorLogBase(X: RAT, base: INT): INT

Description
These functions compute the integer part (floor) of the logarithm of a rational number in a given base. FloorLog2(X) is just shorthand for FloorLogBase(X,2) ; similarly for FloorLog10 .

NOTE: The signs of X and base are ignored.

These functions were called ILogBase up to version CoCoA-5.1.2.

Example
/**/  FloorLog2(128);
7
/**/  FloorLog10(999);
2
/**/  FloorLogBase(128,2);
7
/**/  FloorLogBase(81.5,3);
4