Round

Rounds a number to the closest integer.

Round( number [, precision ] )

Returns: Number

Argument Description Default
number
number, required

Number to round

precision
number, optional

Number of decimal points to round to

0

Examples

var pi = 3.1415926535;
  var pi_rounded = Round(pi, 2);
  echo(pi); // 3.1415926535
  echo('<br/>'); 
  echo(pi_rounded); // 3.14

See also