@jiminp/tooltool
    Preparing search index...

    Function formatFixedFloat

    • Formats an integer as a fixed-point decimal string.

      Interprets n as integer minor units and formats n / 10 ** fractions. Useful for currency amounts stored as cents or other fixed-point values.

      Parameters

      • n: number

        The finite integer value in minor units.

      • fractions: number

        Integer number of decimal places; non-positive values leave n unscaled.

      Returns string

      The formatted string.

      Positive fractions pads the fractional part to that many digits when the numeric parts use ordinary decimal notation. Large magnitudes are not expanded from exponent notation, so their output may not be a conventional fixed-point decimal. Input precision is limited by JavaScript numbers; formatting cannot recover digits already lost when representing n.

      formatFixedFloat(1234, 2); // "12.34"
      formatFixedFloat(100, 2); // "1.00"