log

log(x)

log(x, base)

Try it yourself:

See also:

log(): Natural Logarithm

log() returns the natural logarithm, the exponent to which e must be raised to obtain the input. It is fundamental in growth models, likelihoods, information theory, and reversing exponential processes.

Domain and scale

For real arithmetic, log(x) requires x > 0. log(1) is zero, and values between zero and one have negative logs. Use exp() to reverse it and log1p() for accurate log(1+x) when x is small.

For another base, use log10() or log2(). Normalize physical quantities before logarithms: their arguments should be positive and dimensionless.

Try Log in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions