Skip to main content

Module det_math

Module det_math 

Source
Expand description

Deterministic math functions for cross-platform WASM reproducibility.

Provides det_sin, det_cos, det_sincos, det_atan2, det_hypot, det_exp, and det_powi_f64 using only IEEE 754 operations that map to WASM intrinsics (add, sub, mul, div, floor, sqrt, abs, copysign, bit-pattern manipulation). No calls to Math.sin, Math.cos, Math.exp, etc.

Algorithms and coefficients are classical polynomial approximations of IEEE 754 transcendentals (Cody-Waite range reduction + minimax polynomials evaluated by Horner’s scheme), guaranteeing < 1 ULP error for all functions. det_powi_f64 is exponentiation-by-squaring on bit-exact IEEE 754 multiply — exact by construction.

Functions§

det_atan2
Deterministic atan2(y, x) — uses only WASM-intrinsic f64 operations.
det_cos
Deterministic cosine — uses only WASM-intrinsic f64 operations.
det_exp
Deterministic exp(x) — classical exp polynomial with Cody-Waite ln(2) range reduction.
det_hypot
Deterministic hypot(x, y) = sqrt(x² + y²).
det_powi_f64
Deterministic integer-exponent power: base^n for n: i32.
det_sin
Deterministic sine — uses only WASM-intrinsic f64 operations.
det_sincos
Deterministic sin and cos computed together (shared range reduction).