TorchLean API

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

Fixed and scientific decimal output #

Both notations take a number of digits after the decimal point. Fixed output rounds on the grid 10^(-places), and 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. Model.format selects them with style := .fixed places and style := .scientific places.

Round an exact decimal once on the grid 10^(-places).

Instances For

    Round an exact decimal once to places + 1 significant digits.

    Instances For
      @[inline]

      Fixed output of an exact dyadic with places fractional digits and its rounding status.

      Instances For
        @[inline]

        Scientific output of an exact dyadic with places + 1 significant digits and its status.

        Instances For