Exactness of single-quotient rounding #
If num = den * q + r, with r < den, dividing 2 * num yields 2 * q below the
midpoint and 2 * q + 1 at or above it. Its low two bits and the equality test
den * quotient = 2 * num therefore carry all the information ties to even needs. The low-word
product can only reject that equality, and a low-word match is checked in full.
Nearest-away rounding reuses the nearest-even and directed branches, and its supplied-exponent tie
test is the reference rationalIsGridTieScaled.
On a doubled numerator, roundEvenDoubled rounds to nearest even for any nonzero divisor.
Fusing the binary scale into the doubled numerator preserves quotient rounding.
Directed rounding uses the same lower and upper adjacent integers as the reference.
The IEEE branch is ieeeRoundRatScaled, thresholds, carries, signed zeros and ties included.
The descriptor-generic branch is the reference rounder roundRatScaledGeneral.
Both directed magnitudes agree with the reference rational rounder.
Selecting the IEEE or descriptor-generic branch gives the reference nearest-even rounder.
With a correct rational exponent, the tie test is the reference rational grid-tie test.
A correct rational exponent suffices for exact agreement in every rounding direction.
roundScaled equals exact rational rounding, with no width or format restriction.
Two normalized significands of the same precision have ratio in (1/2, 2).
Their relative order therefore determines its binary exponent.