Math.log2
Math.log2
Function
Binary logarithm. Returns the base 2 logarithm of value.
Syntax
Math.log2(value)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| value | Number | is | None | a true number. |
Return value
| Type | Description |
|---|---|
| Int/Float | Returns the base 2 logarithm of value. An Int is returned for integer results, and a Float for non-integer or non-finite results. |
Example
result = Math.log2(8) // Output: 3 print result
Notes
- Integer results return Int.