Skip to main content

Module math

Module math 

Source
Expand description

Small math helpers.

Basic IEEE operations (+ - * /, sqrt, floor, round, min, max) give identical results on every platform. Transcendental functions (pow, exp, sin) do not when they come from the platform’s C library, so they must go through libm, which is pure Rust and identical everywhere.

Constants§

TAU
The full circle constant (τ)

Functions§

clamp01
lerp
pm
Per-mille integer to a fraction.
pow
x^y via libm (deterministic across platforms).
sin
sin(x) via libm (deterministic across platforms).
smoothstep
Hermite smoothstep between e0 and e1.