Expand description
Explicit numeric operations and conversions shared across crate boundaries.
Constants§
- DECIMAL_
RADIX 🔒 - EPSILON
- Floating-point comparison tolerance for condition checks.
- INTERPOLATION_
WINDOW 🔒 - U8_
MAX_ 🔒AS_ U32 - U32_
RANGE_ 🔒AS_ F64
Functions§
- deficit_
of - The non-negative shortfall of
curbelowmax. - f64_
to_ i32_ saturating_ ceil - Rounds an
f64upward and saturates it toi32. - f64_
to_ i32_ saturating_ round - Rounds an
f64to the nearest integer and saturates it toi32. - f64_
to_ i32_ saturating_ trunc - Truncates an
f64and saturates it toi32. - f64_
to_ i64_ saturating_ floor - Rounds an
f64downward and saturates it toi64. - f64_
to_ i64_ saturating_ round - Rounds an
f64to the nearest integer and saturates it toi64. - f64_
to_ i64_ saturating_ trunc - Truncates an
f64and saturates it toi64. - f64_
to_ u8_ saturating_ trunc - Truncates an
f64and saturates it tou8. - f64_
to_ u32_ saturating_ ceil - Rounds an
f64upward and saturates it tou32. - f64_
to_ u32_ saturating_ round - Rounds an
f64to the nearest integer and saturates it tou32. - f64_
to_ u32_ saturating_ trunc - Truncates an
f64and saturates it tou32. - f64_
to_ u64_ saturating_ ceil - Rounds an
f64upward and saturates it tou64. - f64_
to_ u64_ saturating_ floor - Rounds an
f64downward and saturates it tou64. - f64_
to_ u64_ saturating_ round - Rounds an
f64to the nearest integer and saturates it tou64. - f64_
to_ u64_ saturating_ trunc - Truncates an
f64and saturates it tou64. - f64_
to_ usize_ saturating_ round - Rounds an
f64to the nearest integer and saturates it tousize. - f64_
to_ usize_ saturating_ trunc - Truncates an
f64and saturates it tousize. - float_
eq - Compares two floats for equality within
EPSILONtolerance. - float_
ne - Inverse of
float_eq. - i32_
to_ u8_ saturating - Saturates an
i32to the range representable byu8. - i32_
to_ u32_ nonnegative - Converts a nonnegative
i32tou32, clamping negative values to zero. - i64_
to_ f64 - Converts an
i64tof64with the same rounding as Rust’s native cast. - interpolate_
sorted - Interpolates
xover points sorted ascending by their first coordinate. - pct_of
curas a percentage ofmax, returning0.0whenmax <= 0.- round_
to_ decimals - Rounds an
f64to the requested number of decimal places. - safe_
div - Returns
0.0on division by zero instead of panicking. - true_
mod - True modulo: result has the sign of the divisor (unlike Rust’s
%);0.0on division by zero. - u32_
to_ i32_ saturating - Saturates a
u32to the range representable byi32. - u64_
to_ f64 - Converts a
u64tof64with the same rounding as Rust’s native cast. - usize_
to_ f64 - Converts a
usizetof64with the same rounding as Rust’s native cast. - usize_
to_ u32_ saturating - Saturates a
usizeto the range representable byu32.