TorchLean API

NN.Floats.IEEEExec.Semantics.ErrorBounds

IEEE32Exec per-op real error bounds (finite branch) #

NN.Floats.IEEEExec.Bridge.FP32Total provides refinement theorems of the form

$$ \operatorname{toReal}(\operatorname{op}_{\mathrm{exec}}(x,y)) =\operatorname{fp32Round}\!\left( \operatorname{op}_{\mathrm{real}}(\operatorname{toReal}(x),\operatorname{toReal}(y)) \right), $$

valid when the executable result stays finite (no NaN/Inf).

This file turns those equalities into the standard half-ULP absolute error bounds you want in numerical proofs:

$$ \left| \operatorname{toReal}(\operatorname{op}_{\mathrm{exec}}(x,y)) -\operatorname{op}_{\mathrm{real}}(\operatorname{toReal}(x),\operatorname{toReal}(y)) \right| \le \varepsilon_{32}\!\left( \operatorname{op}_{\mathrm{real}}(\operatorname{toReal}(x),\operatorname{toReal}(y)) \right). $$

We intentionally do not provide bounds for sin/cos here: the current executable implementation is deterministic (see NN.Floats.IEEEExec.Exec32), but it is an algorithmic approximation rather than “real trig + one rounding step”, so its real-analytic error bounds live in a separate trig-specific theory file.

fp32Round has the standard half-ULP absolute error bound.

In the normal range, executable binary32 rounding has relative error at most $2^{-24}$.

Addition absolute error bound for IEEE32Exec on the finite branch.

Informal: if add x y stays finite then $|\operatorname{toReal}(\operatorname{add}(x,y)) -(\operatorname{toReal}(x)+\operatorname{toReal}(y))| \le\varepsilon_{32}(\operatorname{toReal}(x)+\operatorname{toReal}(y))$.

Subtraction has the standard half-ULP bound whenever the executable result is finite.

Multiplication absolute error bound for IEEE32Exec on the finite branch.

Informal: if mul x y stays finite then $|\operatorname{toReal}(\operatorname{mul}(x,y)) -\operatorname{toReal}(x)\operatorname{toReal}(y)| \le\varepsilon_{32}(\operatorname{toReal}(x)\operatorname{toReal}(y))$.

Division absolute error bound for IEEE32Exec on the finite branch.

Informal: if div x y stays finite then $\left|\operatorname{toReal}(\operatorname{div}(x,y)) -\frac{\operatorname{toReal}(x)}{\operatorname{toReal}(y)}\right| \le\varepsilon_{32}\!\left( \frac{\operatorname{toReal}(x)}{\operatorname{toReal}(y)} \right)$.

FMA absolute error bound for IEEE32Exec on the finite branch.

Informal: if fma x y z stays finite then $|\operatorname{toReal}(\operatorname{fma}(x,y,z)) -(\operatorname{toReal}(x)\operatorname{toReal}(y)+\operatorname{toReal}(z))| \le\varepsilon_{32}( \operatorname{toReal}(x)\operatorname{toReal}(y)+\operatorname{toReal}(z) )$.

Square-root absolute error bound for IEEE32Exec on the finite branch.

Informal: if sqrt x stays finite then $|\operatorname{toReal}(\operatorname{sqrt}(x))-\sqrt{\operatorname{toReal}(x)}| \le\varepsilon_{32}(\sqrt{\operatorname{toReal}(x)})$.