ilog2
compute integer base 2 logarithm
ilog10
compute integer base 10 logarithm
ilog[b]
compute integer base b logarithm
ilog
compute integer natural logarithm
Calling Sequence
Parameters
Description
Thread Safety
Examples
ilog2(x)
ilog10(x)
ilog[b](x)
ilog(x)
x
-
expression
b
positive real number
These functions compute integer approximations to logarithms. They are based on the IEEE function logb.
For real values and positive numeric values , the function computes the integer base logarithm of ; that is, the logarithm rounded down to the nearest integer.
If , then returns such that .
For complex values , computes .
The following relations hold for infinite and undefined values:
If , then and .
For all , we have .
You can enter the command ilog[b] using either the 1-D or 2-D calling sequence. For example, ilog[3](50) is equivalent to .
The and functions compute the same values as and , respectively. They both have more efficient implementations than the default algorithm for for . (Indeed, and are generally computed using the and commands.)
There are sometimes situations where you need a rough approximation of the size of the number, where to any base will do. Then using is probably the best choice. (It is even faster than for some cases.)
The function computes , approximating the natural logarithm of .
The computation of and is more efficient than for .
The ilog2 and ilog10 commands are thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
The powers of are very close to the Lucas numbers. In particular, is a tiny bit less than the 2000th Lucas number, and is a tiny bit more than the 2001st Lucas number. Consequently, the base- logarithm of both the 2000th and 2001st Lucas number are strictly between 2000 and 2001 - so the answers from should be 2000 in both cases.
See Also
exceptions
float
initialfunctions
type
Download Help Document