round

Description Syntax Parameters Returns Example
Rounds to a defined set of decimal places. round(num, decimalPlaces, roundingMethod) num: Number or array of numbers.

decimalPlaces: Number of decimal places to round to (Optional). Default to 0.

roundingMethod: Rounding method (Optional)

HALF_UP - default, round up towards "nearest neighbor".

CEILING - round towards positive infinity.

DOWN - truncate and round down towards zero.

FLOOR - round towards negative infinity.

HALF_DOWN - round down towards "nearest neighbor"

HALF_EVEN - round towards even "nearest neighbor"

UNNECESSARY - assert an exact result.

UP - increment and round up to zero.

The array of number values. round((11 / 9))

equivalent to round((11 / 9), 0, 'HALF_UP')

round((11 / 9), 2)

equivalent to round((11 / 9), 2, 'HALF_UP')

round((11 / 9), 2, 'CEILING')

round({(11 / 9), 10.234, 99.455}, 2, 'CEILING')