log() : Natural Logarithm
On this page
Summary
Calculate the natural logarithm (base e) of a number.
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
Data:
doc.Params["model"] = new {
value = 10
};
Output:
<p>ln(10) = 2.303</p>
Time to Double
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