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

NameTypeDescription
xreal numberInput real value.
basereal numberPositive 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))
Python Reference