Deterministic nearest-even rational rounding #
This is the exact Rat-to-Int specialization of the shared quotient-rounding decision. It uses
integer numerator and denominator arithmetic throughout; no floating approximation is introduced
while deciding a tie.
The proofs cover both signs, the half-unit error bound, fixed points, and exact half steps. Keeping those facts beside the executable definition gives fixed-point and mixed-precision code one rounding primitive with a stable, reusable contract.
Round an exact rational to the nearest integer, breaking halfway cases toward the even result.
Instances For
Nearest-even quotient rounding differs from the exact nonnegative rational by at most one half.
Nearest-even rational rounding fixes every integer exactly.
Nearest-even rational rounding differs from its exact input by at most one half.
An exact quotient midpoint rounds to an even natural number.
Half-unit error can occur only when the delivered integer is even, for either sign.
The shared quotient algorithm agrees with the floor/ceiling nearest-even decision.