TorchLean API

NN.Floats.NeuralFloat.Error.Addition

Exactness of Addition Errors #

For nearest rounding, the error of adding two representable values is itself representable. The proof aligns both operands on the smaller canonical grid, represents the rounded result on that same grid, and uses nearestness to control the canonical exponent of the error.

The nearest-rounded addition error of two representable values is representable.

theorem TorchLean.Floats.neural_generic_format_FLT_to_FIX {β : NeuralRadix} (emin prec : ) (hprec : 0 < prec) {x : } (hx : neuralGenericFormat β (FLTExp emin prec) x) :

Every FLT value lies on its minimum-exponent FIX grid.

theorem TorchLean.Floats.neural_generic_format_FIX_to_FLT_of_abs_le {β : NeuralRadix} (emin prec : ) (hprec : 0 < prec) {x : } (hx : neuralGenericFormat β (FIXExp emin) x) (hbound : |x| neuralBpow β (prec + emin)) :
neuralGenericFormat β (FLTExp emin prec) x

A bounded FIX value is FLT-representable, including the radix-power boundary.

theorem TorchLean.Floats.neural_generic_format_FLT_add_small {β : NeuralRadix} (emin prec : ) (hprec : 0 < prec) {x y : } (hx : neuralGenericFormat β (FLTExp emin prec) x) (hy : neuralGenericFormat β (FLTExp emin prec) y) (hbound : |x + y| neuralBpow β (prec + emin)) :
neuralGenericFormat β (FLTExp emin prec) (x + y)

A sufficiently small sum of two FLT values is exactly FLT-representable.