Range guarantees for the selected decimal grid #
The input's exact coefficient on the selected grid is less than 10 ^ precision.
Whenever it is coarser than the subnormal grid, it also retains a full leading
digit. These bounds justify the later single-digit carry and overflow decisions.
Zero has no significant digits and therefore uses the least quantum.
The zero shortcut agrees with the digit-count formula for every rational magnitude.
theorem
FloatLib.Floats.Formats.DecimalInterchange.scaleShift_lower
{p : ℕ}
(hp : 0 < p)
{x : ℚ}
(hx : 0 ≤ x)
(hk : 0 < scaleShift p x)
:
theorem
FloatLib.Floats.Formats.DecimalInterchange.div_roundingQuantum_lt
(f : Format)
{x : ℚ}
(hx : 0 ≤ x)
:
The exact scaled magnitude fits strictly below the coefficient bound.
theorem
FloatLib.Floats.Formats.DecimalInterchange.roundingQuantum_le
(f : Format)
{x : ℚ}
(hx : 0 ≤ x)
{q : ℤ}
(hq : f.minQuantum ≤ q)
(hfit : x < ↑f.coefficientBound * 10 ^ q)
:
The selected quantum is the smallest quantum with a fitting exact coefficient.
theorem
FloatLib.Floats.Formats.DecimalInterchange.payloadBound_le_div_roundingQuantum
(f : Format)
{x : ℚ}
(hx : 0 ≤ x)
(hq : f.minQuantum < roundingQuantum f x)
:
Above the subnormal grid, the exact scaled coefficient has a full leading digit.