Functions for numeric computation. All trigonometric functions work in radians. Both single and float variants exist for every function — choose single for speed, float for precision. Integer operations loft#984 — the declared-RANGE guard, applied to the VALUE at a store into a slot that declares one (`integer limit(lo, hi)`, a narrow width). A value outside `lo..=hi` takes the slot's DEFAULT — `dflt` is the lowest value in range, or the null sentinel where the slot admits null — and reports it, rather than being wrapped, aliased, or dropped.
It guards the VALUE rather than the store, which is what lets one op reach both a FIELD and a VARIABLE: a variable has no store op to carry the range, and that is why a declared range on a local went unenforced entirely.
A null passes straight through: whether a null may land in this slot is `(N-Store)`'s question, answered at compile time, and substituting `lo` for it here would quietly invent a value the program never computed.
Emitted only where the value is NOT provably in range, so ordinary in-range code pays nothing (`parser::expressions::range_guard`).
pub fn abs(both: integer) -> integer
Absolute value. Removes the sign from a negative integer.
pub fn floor_mod(both: integer, divisor: integer) -> integer?
Floor modulo — the remainder that takes the sign of the DIVISOR, so `x.floor_mod(n)` lands in `[0, n)` for a positive `n`. The `%` operator truncates toward zero and keeps the DIVIDEND's sign (`-1 % 3 == -1`); `floor_mod` wraps (`(-1).floor_mod(3) == 2`), which is what circular indexing / wrap-around wants (`grid[(i - 1).floor_mod(w)]`). `x.floor_mod(0)` is null, like `%` (C80 — an undefined value is a null, never a fault).
pub fn abs(both: single) -> single
Absolute value for single-precision floats.
pub fn cos(both: single) -> single
Cosine. Use for circular motion: x = r * cos(angle).
pub fn sin(both: single) -> single
pub fn tan(both: single) -> single
pub fn acos(both: single) -> single?
pub fn asin(both: single) -> single?
pub fn atan(both: single) -> single
pub fn ceil(both: single) -> single
pub fn floor(both: single) -> single
pub fn round(both: single) -> single
pub fn sqrt(both: single) -> single?
pub fn atan2(both: single, v2: single) -> single
Arc tangent of y/x, preserving the correct quadrant. Use instead of atan when you have separate x/y components.
pub fn log(both: single, v2: single) -> single?
pub fn pow(both: single, v2: single) -> single?
Raises base to the power exp. Use for exponential growth curves and scaling.
pub fn abs(both: float) -> float
Absolute value for double-precision floats.
pub PI = OpMathPiFloat()
The ratio of a circle's circumference to its diameter (3.14159...).
pub E = OpMathEFloat()
Euler's number, the base of natural logarithms (2.71828...).
pub fn cos(both: float) -> float
Cosine. Use for circular motion: x = r * cos(angle).
pub fn sin(both: float) -> float
pub fn tan(both: float) -> float
pub fn acos(both: float) -> float?
pub fn asin(both: float) -> float?
pub fn atan(both: float) -> float
pub fn ceil(both: float) -> float
pub fn floor(both: float) -> float
pub fn round(both: float) -> float
pub fn sqrt(both: float) -> float?
pub fn atan2(both: float, v2: float) -> float
Arc tangent of y/x, preserving the correct quadrant. Use instead of atan when you have separate x/y components.
pub fn log(both: float, v2: float) -> float?
pub fn pow(both: float, v2: float) -> float?
Raises base to the power exp. Use for exponential growth curves and scaling.