Grid bounds for directed rational packing #
The executable packer rescales a rational to the subnormal or normal grid, then rounds its quotient to an integer. Rescaling by a power of two and restoring that scale preserves the exact value. The bounds below describe the scaled quotient and its floor and ceiling.
Packing.Branches identifies the corresponding executable branches. Packing.Downward and
Packing.Upward use these inequalities to bound the packed results.
Exact scale changes and integer bounds #
The subnormal alignment shift is the negation of the smallest subnormal exponent.
Rescaling onto the subnormal grid and back is the identity on the exact rational value.
Rescaling onto the normal grid at a leading exponent and back is the identity on the exact rational value.
The quotient scaled to the normal grid lies in the normalized mantissa interval.
In the subnormal range, the quotient scaled to the subnormal grid lies in [1, 2 ^ fracWidth).
Directed rounding on the normal grid stays within the closed normalized mantissa interval.
In the subnormal range, directed rounding on the subnormal grid lies in [1, 2 ^ fracWidth].
Downward rounding on the subnormal grid stays strictly below the smallest normal mantissa.
Downward rounding on the normal grid never carries out of the normalized mantissa interval.
Exact real bounds on the packing grids #
Downward quotient rounding on the subnormal grid lies below the exact scaled rational.
The exact scaled rational lies below upward quotient rounding on the subnormal grid.
Downward quotient rounding on the normal grid lies below the exact scaled rational.
The exact scaled rational lies below upward quotient rounding on the normal grid.