Branch equations for directed rational packing #
roundRatMagnitudeDirectedScaled checks the denominator and zero before choosing an overflow,
underflow, subnormal, normal, or carry-out result. The equations below isolate its
positive-magnitude branches for the directed bound proofs. Sign restoration is proved separately.
Positive packing branches #
Positive directed packing of a nonzero rational, exposing the exponent, significand, and finite-field guards.
Above the largest normal exponent, positive directed packing returns the directed overflow result.
Below the smallest subnormal exponent, positive directed packing returns the smallest subnormal when rounding up and zero when rounding down.
In the subnormal range, positive downward packing stores the truncated quotient as a subnormal.
In the subnormal range, positive upward packing stores the ceiling quotient as a subnormal, or the smallest normal value when the quotient fills the mantissa.
In the normal range of an IEEE descriptor, positive downward packing stores the truncated mantissa at the leading exponent.
In the normal range of an IEEE descriptor, upward packing without a carry stores the ceiling mantissa at the leading exponent.
A carry-out whose incremented exponent still fits stores the smallest mantissa one binade higher.
A carry-out past the largest normal exponent returns the directed overflow result.