TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Projection.ScaleProof

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) :
10 ^ (p + scaleShift p x - 1) ≤ x
theorem FloatLib.Floats.Formats.DecimalInterchange.scaleShift_le_of_lt {p k : ℕ} (hp : 0 < p) {x : ℚ} (hx : 0 ≤ x) (h : x < 10 ^ (p + k)) :

Any coarser grid which fits the coefficient bound is above the selected grid.

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.

Above the subnormal grid, the exact scaled coefficient has a full leading digit.