TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Formatting.Words

Decimal character conversion for BID and DPD words #

The encoding and width select only the source/destination codec. Parsing, precision rounding, and status handling use the shared datum operations. Exact output followed by input recovers the canonical word: redundant encodings are not character-level representation information.

An encoded decimal result and the five conversion flags.

  • word : BitVec f.bitWidth

    The result encoded in the selected BID or DPD layout.

  • status : Status

    IEEE exception indicators raised by character conversion.

Instances For

    Parse and round once, then encode the valid result as BID or DPD.

    Instances For

      Decode a word and apply the requested decimal output precision.

      Instances For
        theorem FloatLib.Floats.Formats.DecimalInterchange.Formatting.decode_parseWord (encoding : Encoding) (f : Format) (mode : RoundingMode) (text : String) :
        encoding.decode f (parseWord encoding f mode text).word = (parse f mode text).value

        The word parser encodes precisely the datum parser's result, including special fields.

        @[simp]
        theorem FloatLib.Floats.Formats.DecimalInterchange.Formatting.parseWord_status (encoding : Encoding) (f : Format) (mode : RoundingMode) (text : String) :
        (parseWord encoding f mode text).status = (parse f mode text).status

        Encoding introduces no additional flags.

        theorem FloatLib.Floats.Formats.DecimalInterchange.Formatting.parseWord_formatWord_exact (encoding : Encoding) (f : Format) (outputMode inputMode : RoundingMode) (word : BitVec f.bitWidth) :
        parseWord encoding f inputMode (formatWord encoding f outputMode Numerics.DecimalText.Precision.exact word).text = { word := encoding.canonicalize f word }

        Exact text roundtrips every word to its canonical representative, in any pair of modes.