TorchLean API

FloatLib.Floats.Formats.BinaryInterchange.Conversion.Text.DecimalFormatting

Fixed and scientific decimal output #

Both styles take a number of digits after the decimal point. Fixed output rounds on the grid 10^(-places); scientific output keeps places + 1 significant digits. Rounding happens once on the exact decimal value, before inserting the point and exponent. Trailing zeros express the requested precision, and a negative value that rounds to zero retains its sign.

These operations use exact integer arithmetic for any binary descriptor. They do not call the host floating-point printer. Infinities and NaNs use the same diagnostic spelling as formatDecimal.

Conventional decimal notation, with precision measured after the decimal point.

  • fixed (places : ) : DecimalStyle

    Ordinary decimal notation with exactly this many fractional digits.

  • scientific (places : ) : DecimalStyle

    One digit before the decimal point and this many after it, followed by an e exponent.

Instances For

    Round an exact decimal once at the precision required by the selected notation.

    Instances For

      Render a decimal already rounded by roundDecimalForStyle with this same style. The decimal record supplies the fractional places; this step only inserts notation.

      Instances For

        Fixed or scientific output of an exact dyadic, including numerical rounding status.

        Instances For

          Decimal output with an explicit notation, rounding direction, and inexact indicator.

          Instances For

            Nearest-even decimal output with exactly places digits after the decimal point.

            Instances For

              Nearest-even scientific output with places + 1 significant digits and an e exponent.

              Instances For