TorchLean API

FloatLib.Floats.Formats.Flocq.Theory.Special.FTZ

Abrupt Underflow #

ftzExp emin prec is the Flocq abrupt-underflow exponent selector. Below the smallest normal magnitude it selects the normal threshold emin + prec - 1; above that threshold it agrees with the unbounded precision-prec selector. A matching rounding mode can therefore flush values below the normal range directly to zero.

Exponent selection with precision prec and smallest normal value β^(emin + prec - 1).

Instances For

    The radix exponent of the smallest normal value in the abrupt-underflow format.

    Instances For
      theorem FloatLib.Floats.Formats.Flocq.ftzExp_eq_threshold {emin prec e : } (h : e ftzThreshold emin prec) :
      ftzExp emin prec e = ftzThreshold emin prec

      Below the threshold, ftzExp selects the threshold itself.

      theorem FloatLib.Floats.Formats.Flocq.ftzExp_eq_sub {emin prec e : } (h : ftzThreshold emin prec < e) :
      ftzExp emin prec e = e - prec

      Above the threshold, ftzExp agrees with e - prec.

      @[reducible, inline]
      abbrev FloatLib.Floats.Formats.Flocq.ftzValidExp (emin prec : ) (hprec : 0 < prec) :
      ValidExp (ftzExp emin prec)

      Positive-precision abrupt-underflow exponent selection satisfies Flocq validity.

      Instances For
        theorem FloatLib.Floats.Formats.Flocq.validExp_FTZ_iff (emin prec : ) :
        ValidExp (ftzExp emin prec) 0 < prec

        ftzExp emin prec satisfies the exponent axioms exactly for positive precision.

        The abrupt-underflow exponent selector associated with a checked precision.

        Instances For

          A checked precision automatically discharges the abrupt-underflow validity obligation.

          The threshold is a negligible exponent for the abrupt-underflow format.

          theorem FloatLib.Floats.Formats.Flocq.ulp_zero_FTZ {β : Numerics.Radix} (emin prec : ) (hprec : 0 < prec) :
          ulp β (ftzExp emin prec) 0 = bpow β (ftzThreshold emin prec)

          The ULP at zero in the abrupt-underflow format is the smallest normal magnitude.

          noncomputable def FloatLib.Floats.Formats.Flocq.fTZRound (rnd : ) (x : ) :

          Flush an inexact scaled mantissa to zero when its magnitude is below one.

          Instances For

            Flushing around (-1,1) preserves monotonicity and exact integer values.

            theorem FloatLib.Floats.Formats.Flocq.round_FTZ_small {β : Numerics.Radix} (emin prec : ) (hprec : 0 < prec) (rnd : ) (x : ) (hsmall : |x| < bpow β (ftzThreshold emin prec)) :
            round (fTZRound rnd) x = 0

            Values below the smallest-normal threshold flush exactly to zero.

            theorem FloatLib.Floats.Formats.Flocq.round_FTZ_eq_FLX_of_normal {β : Numerics.Radix} (emin prec : ) (hprec : 0 < prec) (rnd : ) (x : ) (hnormal : bpow β (ftzThreshold emin prec) |x|) :
            round (fTZRound rnd) x = round rnd x

            At normal magnitudes, abrupt-underflow rounding agrees with FLX rounding.

            Exact abrupt-underflow values are zero or normal-range FLX values.

            Instances For
              theorem FloatLib.Floats.Formats.Flocq.not_ftzFormat_of_nonpos {β : Numerics.Radix} (emin prec : ) (hprec : prec 0) (x : ) :
              ¬FTZFormat emin prec x

              Nonpositive precision is rejected by the explicit abrupt-underflow format predicate.

              theorem FloatLib.Floats.Formats.Flocq.ftzFormat_of_generic {β : Numerics.Radix} (emin prec : ) (hprec : 0 < prec) {x : } (hx : genericFormat β (ftzExp emin prec) x) :
              FTZFormat emin prec x

              The generic format generated by ftzExp satisfies the explicit abrupt-underflow predicate.

              theorem FloatLib.Floats.Formats.Flocq.generic_of_ftzFormat {β : Numerics.Radix} (emin prec : ) (hprec : 0 < prec) {x : } (hx : FTZFormat emin prec x) :
              genericFormat β (ftzExp emin prec) x

              Every explicit abrupt-underflow value belongs to the generic ftzExp format.

              theorem FloatLib.Floats.Formats.Flocq.generic_format_FTZ_iff {β : Numerics.Radix} (emin prec : ) (hprec : 0 < prec) (x : ) :
              genericFormat β (ftzExp emin prec) x FTZFormat emin prec x

              FTZFormat is exactly the generic format generated by ftzExp.