Function toFixedNumber

  • Rounds a number to a specified number of decimal places using a specified base.

    Parameters

    • num: number

      The number to round.

    • digits: number

      The number of decimal places to round to.

    • base: number = 10

      The base to use for rounding. Defaults to 10 if not provided.

    Returns number

    The rounded number.

    Static

    Example

    toFixedNumber(3.14159, 2);    // Returns 3.14
    toFixedNumber(2.71828, 3, 2); // Returns 2.75

Generated using TypeDoc