std/math
The built-ins already cover square roots, trigonometry, logarithms, rounding,
abs, min, and max; this module adds:
| Name | Value |
|---|---|
PI, TAU, E |
π, 2π, and e |
INFINITY, NAN |
the special floats |
clamp(x, low, high), clamp_int(x, low, high) |
x kept within a range |
lerp(a, b, t) |
the value a fraction t of the way from a to b |
sign(x) |
-1, 0, or 1 |
degrees(r), radians(d) |
angle conversions |
is_close(a, b, tolerance) |
float equality up to a relative tolerance |
gcd(a, b), lcm(a, b) |
greatest common divisor and least common multiple |
sum(values), mean(values), median(values), std_dev(values) |
statistics of an f64[] |