# log ## Category Math ## Arity **Unary** — `log `. ``` log ``` ## Description Returns the **natural logarithm** (base e) of a number. Input is **clamped to ε** (machine epsilon, ~2.22e-16) as a minimum — zero or negative inputs return a very large negative number instead of throwing. Auto-unwraps `shared` values. ## How It Works Calls `Math.Log(max(epsilon, x))`. The clamping prevents errors from zero/negative inputs. This matches the safety-oriented behavior of the SQ# math library. ## Usage ```sqf log 1; // 0 log 2.71828; // ~1 log 10; // 2.302... // Decay constant _k = log 2 / _halfLife; // Log-scale comparison if (log _a > log _b) then { ... }; // same as a > b for positive // Information / entropy _entropy = -_p * log _p; ``` ## Thread Safety ReadOnly — pure computation. Safe from any scheduler. ## See Also - [exp](exp.md) — natural exponential (inverse) - [^](pow-operator.md) — general power - [sqrt](sqrt.md) — square root