TorchLean API

FloatLib.Floats.Formats.Posit.Rounding.Direct.Runtime

Executable direct exact-dyadic posit packing #

Direct posit packing rounds the normalized exact-dyadic bit stream in one pass:

Direct packing avoids the reference rounder's search. Its equality to the exact model is proved in Direct.Proof.

@[inline]

Round a positive exact dyadic directly from its normalized bit stream.

Interior values use one general guard/sticky kernel for every width. Regimes that consume the entire payload map directly to maxPos or minPos.

Instances For
    @[inline]

    Pack a positive exact dyadic with the direct guard-and-sticky constructor.

    Instances For
      @[noinline]

      Return the complete signed Posit encoding of an exact dyadic.

      The positive magnitude is packed by the shared arbitrary-width guard/sticky kernel. Sign restoration is the standard whole-word two's complement, with exact zero kept unique.

      Instances For
        @[noinline]

        Round any exact dyadic through the direct positive packer and whole-word sign restoration.

        Exact zero remains the unique unsigned zero. A negative nonzero result uses the Posit Standard (2022)'s whole-word two's-complement symmetry.

        Instances For