Full name
math.log2
Library
math
Syntax
math.log2(x)
Description
The math.log2 function returns the logarithm to base 2 of the number passed as an argument.
Parameters
- x: Number whose logarithm is to be obtained in base 2. It must be a number greater than zero.
Result
The math.log2 function returns a real number.
Examples
We can obtain the logarithm in base 2 of 8 with the following code:
math.log2(8)
3.0