TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Conversion.Text.Representation

Uniqueness of finite binary representations #

The decoded exponent is the canonical exponent of every nonzero finite value. This connects numerical conversion theorems to representation round trips; signed zero is handled separately because real numbers forget its sign.

A nonzero decoded dyadic already uses the format's canonical exponent.

Equal nonzero numerical values have the same canonical decoded exponent.

A dyadic denotes zero exactly when its unsigned coefficient is zero.

theorem FloatLib.Floats.Formats.BinaryInterchange.Model.eq_of_toReal_eq_of_nonzero {fmt : FloatFormat} {x y : Model fmt} (hx : x.isFinite = true) (hy : y.isFinite = true) (hvalue : x.toReal = y.toReal) (hzero : x.toReal 0) :
x = y

Equal nonzero finite real values determine the complete binary word.

In a conventional IEEE format, rounding a decoded nonzero value restores its word.

theorem FloatLib.Floats.Formats.BinaryInterchange.Model.roundDyadicWithRounding_zero (fmt : FloatFormat) (hfmt : fmt.isIEEE = true) (mode : IEEERoundingMode) (negative : Bool) (exponent : ) :
roundDyadicWithRounding fmt mode { negative := negative, significand := 0, exponent := exponent } = zero fmt negative

In a conventional IEEE format, rounding an exact zero preserves its sign.

In a conventional IEEE format, rounding a decoded finite dyadic restores its complete word.