TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Environment.Runtime

Explicit decimal rounding attributes and sticky exception flags #

An arithmetic Outcome records the exceptions raised by one operation. An Environment accumulates those exceptions until a caller clears or restores the selected flags. Passing this state explicitly makes exception behavior available in pure Lean programs and proofs. Flag operations are defined in FloatLib.Numerics.IEEEStatus, shared with binary formats.

The flag operations implement the default-handling state of IEEE 754-2019 §§5.7.4 and 7. They do not change the host floating-point environment. A scoped rounding attribute changes the direction used inside a computation while preserving the exceptions raised there.

@[reducible, inline]

The shared IEEE exception names, independent of radix and precision.

Instances For

    A decimal computation's explicit rounding direction and accumulated exception flags.

    • rounding : RoundingMode

      The rounding direction used by computations in this environment.

    • flags : Status

      Exceptions accumulated until explicitly cleared or restored.

    Instances For

      Set the selected sticky flags without changing the rounding direction.

      Instances For

        Clear the selected sticky flags without changing the rounding direction.

        Instances For

          Test whether any selected current flag is raised.

          Instances For

            Save the current flags for a later test or restoration.

            Instances For

              Restore selected flags from a saved snapshot, including saved clear flags.

              Instances For

                Record an operation's result and accumulate its exceptions in the current flags.

                Instances For

                  Evaluate one operation under the current rounding direction.

                  Instances For

                    Evaluate a computation under a scoped rounding direction. The outer direction is restored; the computation's final flags are preserved.

                    Instances For