round

To round a given number

You can use the function to round a decimal number to the specified number of decimal places. This is done according to the rules of commercial rounding, which means 5 or more is rounded up, 4 or less is rounded down.

If no parameter is specified for the number of decimal places, the system rounds up or down to the nearest integer with no decimal places.

Syntax

round(number)

round(number, number)

Return

number

Examples

round(number, digits) To round a given number with the given number of digits.

round(number) To round a given number to the nearest integer.

round(2.5)

Result: 3

round(12.4987)

Result: 12

round(12.4987,2)

Result: 12.5

round(12/7,1)

Result: 1.7

See also

ceil, which rounds up a given number to the next higher integer.

floor, which rounds a given number down to the nearest integer.

Last updated