math.log2

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

Submitted by admin on Sun, 01/31/2021 - 22:18