TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Codec.Runtime

Decimal word assembly and special values #

IEEE 754-2019 §3.5.2 reserves combination fields 11110 for infinity and 11111 for NaN in both encodings. The next bit is one for a signaling NaN. Canonical encodings clear unused bits. A decoder accepts every word, retaining the sign and the NaN's signaling bit and decimal payload.

Codec separates these shared rules from BID/DPD coefficient encoding. encode? rejects unrepresentable datums; it does not round them.

Assemble a sign and the remaining bits into an exact-width interchange word.

Instances For

    Read all bits below the sign.

    Instances For

      Executable coefficient encodings, separated from their laws in Codec.Proof. Finite decoding returns (coefficient, biasedExponent).

      • encodeFinite : Format

        Pack a finite coefficient and biased exponent into the unsigned payload.

      • decodeFinite : Format ×

        Recover a finite coefficient and biased exponent from the unsigned payload.

      • encodePayload : Format

        Encode the diagnostic payload of a NaN.

      • decodePayload : Format

        Decode the diagnostic payload of a NaN.

      Instances For

        Assemble a datum without rounding. Correct round trips require Datum.Valid; use encode? when representability has not already been established.

        Instances For

          Checked interchange encoding. none means that this width cannot represent the supplied datum exactly, including its quantum exponent or NaN payload.

          Instances For

            Decode every interchange word, accepting the noncanonical encodings specified by IEEE 754-2019 §3.5.2.

            Instances For

              Re-encode a decoded datum, clearing unused special-value bits and replacing redundant significand encodings by their canonical representatives.

              Instances For