Round

Rounds a number to the closest integer.

Method Signature

Round(number=[numeric])

Arguments

Argument
Type
Required
Description
Default

number

numeric

true

The number to be rounded.

Examples

Round 1.56

Run Example

round( 1.56 );

Result: 2

Round 1.49

Run Example

round( 1.49 );

Result: 1

Round -0.9

Run Example

round( -.9 );

Result: -1

Additional Examples

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

Last updated

Was this helpful?