TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Analysis.Error

Error bounds for executable binary floats #

These bounds relate operations on Model fmt to exact real arithmetic. The function toReal interprets finite values in , and the format parameter selects the corresponding Flocq-style grid. This real-valued grid has no upper exponent bound; the executable operation theorems apply when the result is finite.

The operation theorems require finite inputs and outputs because infinities and NaNs have no real value. Signed zeros both have real value zero.

@[reducible, inline]

One unit in the last place at x for the precision and gradual-underflow grid of fmt.

Instances For
    @[reducible, inline]

    Half an ULP at x for the precision and gradual-underflow grid of fmt.

    Instances For
      @[reducible, inline]

      The least positive normal magnitude of fmt.

      Instances For

        The exponent-selection function of every executable format is monotone.

        Nearest-even rounding to fmt has at most half an ULP of absolute error.

        The format-specific epsilonAt follows the subnormal grid near zero, so this statement remains useful where a uniform relative-error bound is impossible.

        The exact real input lies in the half-ULP enclosure around its rounded value.

        Normal-range nearest-even rounding has the standard relative error bound 2^(1-precision) / 2.

        Absolute error of one finite executable addition.

        Absolute error of one finite executable subtraction.

        Absolute error of one finite executable multiplication.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.abs_toReal_div_sub_le {fmt : FloatFormat} (x y : Model fmt) (hfmt : fmt.isIEEE = true) (hx : x.isFinite = true) (hy : y.isFinite = true) (hy0 : y.isZero = false) (hout : (x.div y).isFinite = true) :

        Absolute error of one finite executable division by a nonzero divisor.

        Absolute error of one finite executable square root on a nonnegative input, including either signed zero.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.abs_toReal_fma_sub_le {fmt : FloatFormat} (x y z : Model fmt) (hfmt : fmt.isIEEE = true) (hx : x.isFinite = true) (hy : y.isFinite = true) (hz : z.isFinite = true) (hout : (x.fma y z).isFinite = true) :

        Absolute error of one finite executable fused multiply-add.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.abs_toReal_cast_sub_le {src dst : FloatFormat} (x : Model src) (hsrc : src.isIEEE = true) (hdst : dst.isIEEE = true) (hx : x.isFinite = true) (hout : (cast src dst x).isFinite = true) :
        |(cast src dst x).toReal - x.toReal| epsilonAt dst x.toReal

        Absolute error of one finite cross-format cast.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.add_exact_mem_Icc {fmt : FloatFormat} (x y : Model fmt) (hfmt : fmt.isIEEE = true) (hx : x.isFinite = true) (hy : y.isFinite = true) (hout : (x.add y).isFinite = true) :
        x.toReal + y.toReal Set.Icc ((x.add y).toReal - epsilonAt fmt (x.toReal + y.toReal)) ((x.add y).toReal + epsilonAt fmt (x.toReal + y.toReal))

        The exact sum lies in the half-ULP enclosure around executable addition.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.sub_exact_mem_Icc {fmt : FloatFormat} (x y : Model fmt) (hfmt : fmt.isIEEE = true) (hx : x.isFinite = true) (hy : y.isFinite = true) (hout : (x.sub y).isFinite = true) :
        x.toReal - y.toReal Set.Icc ((x.sub y).toReal - epsilonAt fmt (x.toReal - y.toReal)) ((x.sub y).toReal + epsilonAt fmt (x.toReal - y.toReal))

        The exact difference lies in the half-ULP enclosure around executable subtraction.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.mul_exact_mem_Icc {fmt : FloatFormat} (x y : Model fmt) (hfmt : fmt.isIEEE = true) (hx : x.isFinite = true) (hy : y.isFinite = true) (hout : (x.mul y).isFinite = true) :
        x.toReal * y.toReal Set.Icc ((x.mul y).toReal - epsilonAt fmt (x.toReal * y.toReal)) ((x.mul y).toReal + epsilonAt fmt (x.toReal * y.toReal))

        The exact product lies in the half-ULP enclosure around executable multiplication.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.div_exact_mem_Icc {fmt : FloatFormat} (x y : Model fmt) (hfmt : fmt.isIEEE = true) (hx : x.isFinite = true) (hy : y.isFinite = true) (hy0 : y.isZero = false) (hout : (x.div y).isFinite = true) :
        x.toReal / y.toReal Set.Icc ((x.div y).toReal - epsilonAt fmt (x.toReal / y.toReal)) ((x.div y).toReal + epsilonAt fmt (x.toReal / y.toReal))

        The exact quotient lies in the half-ULP enclosure around executable division.

        The exact square root lies in the half-ULP enclosure around executable square root.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.fma_exact_mem_Icc {fmt : FloatFormat} (x y z : Model fmt) (hfmt : fmt.isIEEE = true) (hx : x.isFinite = true) (hy : y.isFinite = true) (hz : z.isFinite = true) (hout : (x.fma y z).isFinite = true) :
        x.toReal * y.toReal + z.toReal Set.Icc ((x.fma y z).toReal - epsilonAt fmt (x.toReal * y.toReal + z.toReal)) ((x.fma y z).toReal + epsilonAt fmt (x.toReal * y.toReal + z.toReal))

        The exact multiply-add lies in the half-ULP enclosure around executable FMA.

        theorem FloatLib.Floats.Formats.BinaryInterchange.Model.cast_exact_mem_Icc {src dst : FloatFormat} (x : Model src) (hsrc : src.isIEEE = true) (hdst : dst.isIEEE = true) (hx : x.isFinite = true) (hout : (cast src dst x).isFinite = true) :
        x.toReal Set.Icc ((cast src dst x).toReal - epsilonAt dst x.toReal) ((cast src dst x).toReal + epsilonAt dst x.toReal)

        The source real value lies in the half-ULP enclosure around a finite cast.

        The residual of finite nearest-even addition is representable in the same format.