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. Because
this state is an ordinary value, exception behavior is 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.
Rounding direction and accumulated exception flags of a decimal computation.
- rounding : RoundingMode
The rounding direction used by computations in this environment.
- flags : Numerics.IEEEStatus
Exceptions accumulated until a caller clears or restores them.
Instances For
Instances For
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 and the computation's final flags are kept.