Skip to main content Link Search Menu Expand Document Toggle dark mode Copy Code (external link)

log() : Natural Logarithm

Calculate the natural logarithm (base e) of a number.


On this page

Signature

log(value)

Parameters

Parameter Type Required Description
value Number Yes The number (must be positive)

Returns

Type: Double

The natural logarithm of the value.


Examples

Basic Logarithm

<p>ln({{model.value}}) = {{format(log(model.value), '0.000')}}</p>

Data:

doc.Params["model"] = new {
    value = 10
};

Output:

<p>ln(10) = 2.303</p>

Time to Double

<p>Years to double: {{format(log(2) / model.rate, '0.0')}}</p>

Data:

doc.Params["model"] = new {
    rate = 0.07
};

Output:

<p>Years to double: 9.9</p>

Notes

  • Inverse of exp() function
  • Value must be positive (> 0)
  • Returns double-precision floating-point
  • For base-10 logarithm, use log10()
  • Natural log uses base e ≈ 2.71828

See Also