round()

Rounds with the specified precision.

This function is valid in v2.0.0 to v2.13.1. This function has been downloaded 27 times.

Parameters

{number} num
The number to be rounded.
{number=} opt_precision Optional
The precision (as an integer) with which to round the number. Using the precision is similar to doing Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision).

Returns

{number}
Returns num rounded with the specified precision.

Required Functions

This function requires the following functions which are included automatically:

  • ceil()
    Rounds towards Infinity with the specified precision.
  • floor()
    Rounds towards -Infinity with the specified precision.