TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Runtime

Decimal interchange public runtime #

Choose a Format, such as decimal32, decimal64, or decimal128, and explicitly select BID or DPD: a word does not identify its own encoding. Encoding.encode? preserves the exact datum or rejects it; Encoding.decode accepts every word.

transcode implements the same-width encoding conversion of IEEE 754-2019 §5.5.2, preserving the sign, quantum exponent, and NaN metadata. Conversion between different encodings canonicalizes redundant words; conversion to the same encoding copies the word. Neither performs arithmetic or rounding.

Import DecimalInterchange.Basic for the codec and cohort proofs. Arithmetic.Operations provides executable decimal arithmetic, preferred-exponent selection, rounding modes, and exception flags.

The two alternative decimal encodings specified by IEEE 754-2019 §3.5.2.

Instances For

    Coefficient codec selected externally to the interchange word.

    Instances For

      Decode any word, including its sign, quantum exponent, and special-value metadata.

      Instances For

        Encode the complete datum exactly, or reject it if it is invalid for the chosen format.

        Instances For

          Canonical representative of the datum denoted by a word.

          Instances For

            Convert between BID and DPD at the same width, preserving the complete datum. Equal source and target encodings copy the word, following IEEE 754-2019 §5.5.2.

            Instances For