Expand description
Floating-point comparison and rounding utilities.
This module provides tools for safe floating-point arithmetic, including multiple comparison strategies (absolute, relative, ULP-based) and rounding utilities.
Constants§
Functions§
- abs_
diff - Absolute difference:
|a - b|. - almost_
eq - Absolute-tolerance equality:
|a - b| <= eps. - almost_
eq_ rel - Relative-tolerance equality:
|a - b| <= tol * max(|a|, |b|). Equal when both are zero. - almost_
eq_ ulp - ULP-based floating-point equality for
f64. - ceil_
to_ multiple - Round
xup to the nearest multiple ofm. - copysign
- Copy the sign of
bto the magnitude ofa. - epsilon
- Machine epsilon for a generic
Realtype. - floor_
to_ multiple - Round
xdown to the nearest multiple ofm. - is_
close - Combined absolute + relative tolerance comparison.
- is_
infinite - Check if
f64is infinite (positive or negative). - is_nan
- Check if
f64is NaN. - is_
subnormal - Check if
f64is subnormal (denormal). - next_
float - Next representable
f64toward positive infinity. - prev_
float - Next representable
f64toward negative infinity. - relative_
diff - Relative difference:
|a - b| / max(|a|, |b|). - round_
to - Round
xtodecimalsdecimal places. - round_
to_ multiple - Round
xto the nearest multiple ofm. - significant_
figures - Round
xtonsignificant figures. - ulp
- Distance from
xto the next representablef64toward +infinity.