Value-preserving Posit decimal conversion #
The decimal string denotes exactly the decoded dyadic rational. Rounding that rational recovers the original posit word. This proves the decimal preservation guarantee of Posit Standard (2022), §6.3 for every descriptor width.
Exponent clamping #
theorem
FloatLib.Floats.Formats.Posit.Model.roundPositiveCode_of_lt_minPositive
{format : Format}
(target : ℚ)
(hpos : 0 < target)
(hlt : target < minPositiveRat format)
:
Every positive rational below minPos rounds to the code of minPos.
theorem
FloatLib.Floats.Formats.Posit.Model.roundPositiveCode_of_maxPositive_le
{format : Format}
(target : ℚ)
(hle : nonnegativeRatAt format (format.signMaskNat - 1) ≤ target)
:
Every rational at or above maxPos rounds to the code of maxPos.
theorem
FloatLib.Floats.Formats.Posit.Model.maxPositive_le_of_saturationExponent_le
{format : Format}
(s : ℕ)
(e : ℤ)
(hs : s ≠ 0)
(he : decimalSaturationExponent format ≤ e)
:
A nonzero significand scaled at or past the saturation exponent reaches maxPos.
theorem
FloatLib.Floats.Formats.Posit.Model.lt_minPositive_of_le_vanishingExponent
{format : Format}
(s : ℕ)
(e : ℤ)
(he : e ≤ decimalVanishingExponent format s)
:
A significand scaled at or below its vanishing exponent lies strictly below minPos.
theorem
FloatLib.Floats.Formats.Posit.Model.roundRat_clampDecimal
{format : Format}
(d : Numerics.DecimalText.Decimal)
:
Clamping the decimal exponent never changes the rounded posit.
theorem
FloatLib.Floats.Formats.Posit.Model.decimalParse_display
{format : Format}
(value : Model format)
(exact : Numerics.Dyadic)
(hexact : value.toDyadic? = some exact)
:
An ordinary finite word's decimal display has exactly its decoded rational value.