TorchLean API

FloatLib.Numerics.Exact.DecimalText.Runtime

Exact decimal character conversion #

The reusable decimal carrier denotes an integer times an integral power of ten. Parsing accepts ASCII decimal integers, fractions, and e/E exponents with optional signs. Each successful parse denotes an exact rational, without host floating-point conversion.

Every dyadic has a terminating decimal expansion: m / 2^k = (m * 5^k) / 10^k. The formatter uses that identity, with decimal exponent notation for fractional values. Output size and exact-integer work grow with the magnitude of the binary exponent.

An exact signed decimal significand and integral decimal scale.

  • negative : Bool

    Sign of the decimal significand; signed zeros denote the same rational.

  • significand :

    Magnitude of the integer significand.

  • exponent :

    Power of ten multiplying the significand.

Instances For

    Exact rational meaning of a decimal record.

    Instances For

      Recognize precisely the ten ASCII decimal digits.

      Instances For

        Remove at most one leading sign; an absent sign is positive.

        Instances For

          Read a signed decimal integer, requiring at least one digit and complete consumption.

          Instances For

            Read an optional decimal exponent, rejecting incomplete or trailing input.

            Instances For

              Parse decimal characters with an optional leading sign.

              Instances For

                Parse an exact decimal rational. Whitespace and nondecimal notation are rejected.

                Instances For

                  Print an integral exponent with an explicit minus sign only when negative.

                  Instances For

                    Print a decimal record as a decimal significand with an optional e exponent.

                    Instances For

                      Character-string representation of the exact decimal record.

                      Instances For

                        Convert a dyadic to an equal decimal using powers of five for negative binary exponents.

                        Instances For

                          Exact decimal formatting of a dyadic; every finite input has decimal output.

                          Instances For