Directed rounding (down/up) for Flocq-style formats #
For interval propagation under a discrete numeric grid (float, fixed-point, quantization), one typically wants directed rounding at interval endpoints:
In IEEE-754 hardware this corresponds to rounding modes “toward -∞” and “toward +∞”. In TorchLean’s
proof-oriented stack we model this with Flocq-style rounding on ℝ via neural_round together with
the floor/ceil rounding functions from NN/Floats/NeuralFloat/Rounding.lean.
This file is format-generic: it works for any radix β and exponent selection
function fexp satisfying NeuralValidExp.
References:
- IEEE 754-2019 (rounding modes; directed rounding).
- Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed., SIAM, 2002.
- Flocq (rounded arithmetic on reals).
Format-directed rounding down to the (β,fexp) grid (via floor rounding of the scaled
mantissa).
Instances For
Format-directed rounding up to the (β,fexp) grid (via ceil rounding of the scaled mantissa).
Instances For
Correctness of directed rounding down: roundDown x is an enclosure lower bound.
This is the format-generic analogue of the IEEE-754 fact that rounding “toward -∞” never exceeds the exact real value.
Correctness of directed rounding up: roundUp x is an enclosure upper bound.
This is the format-generic analogue of the IEEE-754 fact that rounding “toward +∞” is never below the exact real value.
Canonical rounder for the (β,fexp) format via roundDown/roundUp.