The round() function is used to round a number to a specified number of decimal places. It returns a floating point number rounded off to the given digits precision.

Syntax:

round(number, ndigits = 0)

The required argument, number,  specifies the number to be rounded off. The  optional second argument, ndigits,  specifies the number of decimal places to which the number should be rounded off, it defaults to 0, meaning that the number is rounded off to the nearest integer.

Examples:

round(1)
//1
round(0.5)
//0
round(-0.6)
//-1
round(3.141592)
//3
round(3.141592, 3)
//3.142
round(2.71828182, 0)
//3.0
round(2.71828182, 3)
//2.718