Returns the rounded number to the specified precision.


round(number [, precision])


Name Type Required Description
number long or real The number to calculate the round on.
precision int The number of digits to round to. The default is 0.


The rounded number to the specified precision.

Round is different from the bin() function in that the round() function rounds a number to a specific number of digits while the bin() function rounds the value to an integer multiple of a given bin size. For example, round(2.15, 1) returns 2.2 while bin(2.15, 1) returns 2.


round(2.15, 1)      // 2.2
round(2.15)         // 2 // equivalent to round(2.15, 0)
round(-50.55, -2)   // -100
round(21.5, -1)     // 20