Round

Rounds a number to the closest integer.

Method Signature

Round(number=[numeric], precision=[integer])

Arguments

Argument
Type
Required
Description
Default

number

numeric

true

The number to be rounded.

precision

integer

false

The number of decimal places to round to (default is 0).

0

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

pi = 3.1415926535;
pi_rounded = Round( pi, 2 );
println( pi ); // 3.1415926535
println( pi_rounded );
 // 3.14

Last updated

Was this helpful?