TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Conversion.Text.PrecisionProof

Requested-precision guarantees for binary character output #

The integer rounder is independent of the external radix and the binary descriptor. The shared radix laws then give coefficient bounds, fixed points and the numerical interpretation of the emitted characters.

@[simp]

Every output rounding direction fixes a nonnegative integer.

Nearest-even integer output has error at most one half on a nonnegative magnitude.

An external magnitude rounder never falls below floor.

theorem FloatLib.Floats.Formats.BinaryInterchange.Model.roundTextMagnitude_le_nat (mode : IEEERoundingMode) (negative : Bool) (x : ) (n : ) (hx : 0 x) (hn : x n) :
roundTextMagnitude mode negative x n

An integer upper bound on a magnitude also bounds its rounded coefficient.

Requested decimal output has exactly the requested digit count for nonzero inputs.

Enough decimal digits preserve the exact value, for any binary descriptor and direction.

At a halfway integer, the common output rounder selects the even neighbor.

theorem FloatLib.Floats.Formats.BinaryInterchange.Model.significantMagnitude_nearestEven_error (radix : ) (hradix : 1 < radix) (negative : Bool) (coefficient : ) (quantum : ) (digits : ℕ+) :
|(Numerics.RadixText.significant radix (roundTextMagnitude IEEERoundingMode.nearestEven) negative coefficient quantum digits).1 * radix ^ (Numerics.RadixText.significant radix (roundTextMagnitude IEEERoundingMode.nearestEven) negative coefficient quantum digits).2 - coefficient * radix ^ quantum| radix ^ Numerics.RadixText.significantQuantum radix coefficient quantum digits / 2

The same half-grid error guarantee holds in any external radix greater than one.

Nearest-even hexadecimal output has at most half a requested hexadecimal grid unit of error.

Requested hexadecimal output has exactly the requested digit count for nonzero input.

@[simp]

Exact output raises none of the five exception indicators in either external radix.