Cohort preservation and preferred-exponent bounds #
Removing trailing zeros preserves the exact rational value and sign. The algorithm stops either at its exponent limit or at a coefficient with no trailing zero, so it never discards a significant decimal digit.
Exact integer decomposition, including zero.
The adjusted coefficient never exceeds the original one.
Stopping before the requested quantum means that no further exact decimal shift is possible.
theorem
FloatLib.Floats.Formats.DecimalInterchange.preferredCohort_sameCohort
(f : Format)
(s : Bool)
(c : ℕ)
(q preferred : ℤ)
:
(Datum.finite s c q).SameCohort (preferredCohort f s c q preferred)
Cohort adjustment preserves the exact coefficient-times-quantum value and sign.
theorem
FloatLib.Floats.Formats.DecimalInterchange.preferredCohort_valid
(f : Format)
(s : Bool)
(c : ℕ)
(q preferred : ℤ)
(h : Datum.Valid f (Datum.finite s c q))
:
Datum.Valid f (preferredCohort f s c q preferred)
Cohort adjustment keeps a representable finite datum in the same format.