TorchLean API

FloatLib.Numerics.Enclosure.Elementary.Runtime

Rational enclosures for exponential and logarithm #

Taylor polynomials and their remainder bounds are evaluated with exact rational arithmetic. exp reduces the argument by a power of two and restores the scale by repeated squaring. The reduced logarithm series uses the identity log x = log (1 + t) - log (1 - t), where t = (x - 1) / (x + 1). log first reduces a positive argument to [1, 2), then restores the removed multiple of log 2. Every series argument satisfies |t| ≤ 1/3.

The natural argument controls the polynomial degree, not a floating-point precision or a search timeout. The endpoint error tends to zero as it increases. These kernels return bounds. A caller can use them to separate the exact value from rounding boundaries, or show that both endpoints round to the same result.

The soundness theorems in Elementary.Proof use Mathlib's real Taylor remainder bounds.

The first n terms of the exponential series, evaluated exactly.

Instances For

    Absolute exponential remainder bound for |x| ≤ 1 and n > 0.

    Instances For

      Enclose exp x on |x| ≤ 1, using at least the constant Taylor term.

      Instances For

        A binary reduction scale determined by the integer part of the absolute argument.

        Dividing by this power of two puts the absolute argument below one. Using the quotient rather than the numerator keeps the scale small for high-precision rational inputs close to one.

        Instances For

          Enclose the exponential of any rational argument by reduction and repeated squaring.

          Instances For

            The first n terms of -log (1 - x), before restoring the sign.

            Instances For

              Absolute logarithm remainder bound on |x| < 1.

              Instances For

                Enclose log (1 - x) for |x| < 1.

                Instances For

                  Enclose the natural logarithm of a positive rational with its transformed series.

                  The change of variable maps every positive argument into (-1, 1). Argument reduction before this kernel is useful when a value is far from one, since the series then converges slowly.

                  Instances For

                    Binary logarithm of the integer part, used to reduce arguments at least one.

                    Instances For

                      Enclose the logarithm after removing an exact power of two from the argument.

                      Instances For

                        Enclose the logarithm of a positive rational with binary argument reduction.

                        Inputs below one are inverted first and the resulting interval is negated. Every series is therefore evaluated in [1, 2], independently of the original input's exponent.

                        Instances For