TorchLean API

NN.Widgets.Numerics.Float32

Float32 #

Float32 viewer widget (executable IEEE-754 backend).

Commands:

These widgets are meant for debugging/teaching, not for proof scripts.

Main definitions #

def NN.Widgets.Float32.hex {width : ℕ} (bits : BitVec width) :

Render a bit vector in hexadecimal, preserving the width encoded by its type.

Instances For

    Render exactly width low-order bits of n as a binary string.

    Instances For

      One labelled, colour-coded run of bits: the sign, exponent and fraction fields each get one.

      Colours are given as rgba overlays rather than solid fills so the widget stays readable against both light and dark editor themes.

      Instances For

        Render a dyadic rational as ±mantissa * 2^exponent.

        The significand and exponent come from FloatLib's decoded dyadic value; the sign is kept explicit even for zero.

        Instances For

          Show how a Lean Float (binary64) rounds to an executable float32 (ExecFloat.Binary 8 23, binary32).

          The result is widened to native binary64 for its decimal display. The displayed difference is computed by native binary64 subtraction; it is not an exact-real error certificate.

          Instances For

            Commands #