TorchLean API

NN.Floats.IEEEExec.Bridge.FP32.Ulp

Executable Binary32 ULPs and Absorption #

ulp32 specifies the unit in the last place as a real number. This file supplies the executable counterpart for IEEE32Exec: ulpExp? reads a finite binary32 payload and returns the exponent k for which the ULP is 2^k. It returns none for NaNs and infinities rather than assigning them an artificial spacing.

The absorption test checks whether adding one executable value to another leaves the first value unchanged. Its soundness theorem transports that observation through the finite-operation bridge to the rounded-real binary32 model.

Compute the binary32 ULP exponent from an executable bit pattern.

Finite zero has exponent -149. A finite nonzero value with dyadic mantissa m and exponent e has magnitude ⌊log₂ m⌋ + e + 1; applying fexp32 gives its ULP exponent. NaNs and infinities return none.

Instances For
    @[simp]

    ulpExp? succeeds exactly on finite executable binary32 values.

    NaNs and infinities are precisely the values for which ulpExp? returns none.

    For every finite executable binary32 value, exponentiating the result of ulpExp? gives its rounded-real ULP exactly.

    Direct soundness theorem for the executable query: if ulpExp? x returns k, then 2^k is exactly the rounded-real binary32 ULP at x.

    Whether executable binary32 addition leaves its left operand unchanged.

    Instances For

      If the executable absorption test succeeds on a finite addition, the rounded-real model agrees: rounding the exact real sum returns the left operand.

      Public finite-value form of absorption soundness. Dyadic decoding witnesses are recovered from the three executable finiteness checks.