Math Functions
math.log()
Compute a logarithm of a positive number, natural by default or using a supplied positive base other than one. Both arguments are positional; omission uses the natural-log implementation.
Formal Syntax & Structure
python syntaxpython
math.log(x[, base])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | real number | Input real value. |
| base | real number | Positive logarithm base other than one; omit for natural logarithm. |
Return Value
float
Floating-point result; finite precision and domain restrictions apply.
Working Example
Example Snippetpython
import mathprint(math.log(64, 2))