Expand description
Division-rounding and related operations: div_ceil, div_floor,
exact division, multiple-of computations and overflow-free midpoint,
mirroring the inherent methods on the primitive integer types.
Stability in std (as of nightly 2026): div_ceil / next_multiple_of
(unsigned) are stable since 1.73, is_multiple_of since 1.87, midpoint
since 1.85/1.87; the signed div_ceil / div_floor /
next_multiple_of and div_exact / checked_div_exact are still
nightly-only. Anything newer than the crate’s MSRV is hand-rolled here
with the same algorithm as core.
CT tiers: Midpoint is Tier A (branchless); everything else here
is Tier C (division-based).
Traits§
- DivCeil
- Performs division, rounding the quotient towards positive infinity.
- DivExact
- Performs division without remainder.
- DivFloor
- Performs division, rounding the quotient towards negative infinity.
- Midpoint
- Computes the midpoint (average) of two values without overflowing.
- Multiple
Of - Checks divisibility, mirroring
is_multiple_ofon the unsigned primitives. - Next
Multiple Of - Rounds up to the nearest multiple of a value.