matician - v2.0.0
    Preparing search index...

    Function roundTo

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

      Parameters

      • value: number

        The number to round.

      • decimals: number

        The number of decimal places to round to.

      Returns number

      The rounded number.

      roundTo(3.14159, 2);    // returns 3.14
      roundTo(1.005, 2); // returns 1.01
      roundTo(123.456, 0); // returns 123