TorchLean API

FloatLib.Numerics.Operation.Context

Representation-independent operation context #

Rounding direction, overflow handling, and treatment of tiny outputs describe how an exact value is written into a finite numerical representation. They are operation context rather than properties of a binary bit layout, so they live in the family-independent operation layer.

A concrete format may support only part of this vocabulary. Its quantizer is responsible for giving each policy a precise meaning or rejecting unsupported combinations at a higher API layer.

Rule used when an exact value lies between adjacent representable values.

Instances For

    Behavior when an exact magnitude lies outside the ordinary finite range.

    • native : OverflowMode

      Use the representation's ordinary overflow result.

    • saturate : OverflowMode

      Clamp to the nearest finite endpoint.

    Instances For

      Behavior when a nonzero result lies below the normal range.

      • gradual : UnderflowMode

        Preserve the representation's gradual-underflow values when they exist.

      • flushToZero : UnderflowMode

        Replace tiny stored outputs with the representation's zero.

      Instances For

        Shared policy for converting an exact scalar to a finite numerical representation.

        • rounding : RoundingMode

          Rule used to choose between adjacent representable values.

        • overflow : OverflowMode

          Rule used when the exact magnitude exceeds the finite range.

        • underflow : UnderflowMode

          Rule used for nonzero results below the normal range.

        Instances For

          Nearest-even rounding with native overflow and gradual underflow.

          Instances For

            Nearest-even rounding with saturation and gradual underflow.

            Instances For

              Nearest-even rounding with native overflow and output flush-to-zero.

              Instances For