---
id: math-log
name: Math.log
category: math
kind: namespace-method
tokens: Math.log
sig: Math.log(x) -> fixed
tip: The natural logarithm of x.
order: 30
ns: Math
member: log
---
Returns the natural logarithm ln(x) for x > 0, computed in Q16.16 from a deterministic integer log₂ (bit-scan for the exponent, a short series for the mantissa) scaled by ln 2 — bit-identical on every platform. It is the inverse of Math.exp: reach for it to turn multiplicative growth into a straight line — score-to-level curves, logarithmic difficulty, decibel-style volume. Non-positive inputs are out of domain and saturate to a large negative value rather than returning a meaningful number.
```ludic
program Demo {
handler Step phase Update {
let level = Math.floor(Math.log(score)) # diminishing returns on score
}
}
```