TorchLean API

NN.Examples.DeepDives.Floats.EffectiveRounding

Effective Rounding in Tensor Semantics #

This example uses the same shape-indexed tensor operation twice. The FP32 tensor gives the proof-oriented rounded-real semantics. The ExecFloat.Binary 8 23 tensor executes binary32 arithmetic from bits. On a finite result, the IEEE bridge and the effective rounding calculation identify the same canonical mantissa and exponent.

Vector length; four entries is enough to show the pointwise behaviour without a wall of output.

Instances For
    @[reducible, inline]

    The shape shared by every tensor in this example.

    Instances For

      Proof-oriented tensors use the same tensor API with rounded-real FP32 scalars.

      Instances For

        The rounded-real counterpart of 2. Exactly representable, so rounding is the identity here.

        Instances For

          A vector of ones in the proof-oriented model.

          Instances For

            A vector of twos in the proof-oriented model.

            Instances For

              Their sum, computed by the same addSpec the executable tensors use. The two models share the tensor API and differ only in the scalar type, which is what makes the comparison below meaningful.

              Instances For

                Exact subtraction, local spacing, and absorption #

                Sterbenz's lemma certifies the concrete binary32 subtraction $2-1$ as exact.

                The decoded significand at 1.0 has scale 2^-23, its binary32 spacing.

                Named rounding modes and fused enclosures #

                The public mode API avoids passing a raw integer-rounding function at each call site.

                Instances For

                  Directed rounding gives a certified lower endpoint, not merely a differently named value.

                  Fixed grids, quantization, and double rounding #

                  A signed affine code set with quarter-unit spacing. The construction is not tied to a tensor layout or storage width; those choices only determine the integer code bounds.

                  Instances For

                    Every in-range code is recovered exactly after dequantization and requantization.

                    Four valid codes, represented with the same shape-indexed tensor used by TorchLean models.

                    Instances For

                      IEEE exception status #

                      A training-shaped reduction #