Scaled-dyadic lemmas for the policy agreement proofs #
The general policy engine roundRatGeneralOfDenNeZero receives an exact dyadic
mantissa * 2^exponent as the scaled rational scaleByPowerOfTwo mantissa 1 exponent. The
lemmas here carry that representation through the engine's two quotient sites, the subnormal
alignment and the normal significand, and identify each quotient with a shift primitive of the
dyadic rounders: nearest-even with roundMantissaAtExponentEven, floor and ceiling with
roundMantissaAtExponentDown and roundMantissaAtExponentUp.
roundRatGeneralOfDenNeZero_nearest_dyadic_eq and
roundRatGeneralOfDenNeZero_directed_dyadic_eq compare the engine with the nearest-even and the
directed dyadic packers. Rounding.Policy.Agreement uses them for nearest-even rounding and the
four directed modes, and Rounding.Policy.NearestAwayAgreement for nearest-away rounding.
The policy nearest-even quotient is the shared nearest-even quotient primitive.
Policy truncation is the lower directed quotient primitive.
Positive-direction policy rounding selects floor or ceiling from the encoded sign.
Negative-direction policy rounding selects floor or ceiling from the encoded sign.
Away-from-zero policy rounding is the upper directed quotient primitive.
Absorbing a dyadic exponent into a quotient adds that exponent to its leading bit.
The policy engine's subnormal shift is the distance to the least-subnormal exponent.
The independent rational policy core and descriptor-general dyadic rounder agree under nearest-even rounding.
For a directed mode, the rational policy core applied to an exact dyadic is the shared directed
rational packer. The two sides compute their quotients and branch on their own but share the
packers packRoundedSubnormal and packRoundedNormal. The proof identifies their exact binary
scalings before comparing branches.
The rational directed packer specializes to the corresponding dyadic magnitude packer when the denominator is one.
View the dyadic policy entry point as one exact rational scaling.
The runtime definition branches on the sign of the exponent to avoid constructing an unnecessary intermediate pair. This theorem gives proofs one uniform representation of that same computation.