Skip to content

round

Round to the nearest integer (or to a specified number of digits).

Y = round(X) % script mode
Y = round(X, digits) % Excel-compatible mode

In script mode, returns each element of X rounded to the nearest integer using banker’s-style nearest rounding.

In Excel-compatible mode, the optional digits argument controls the rounding precision: positive values round to fractional digits, negative values round to tens, hundreds, etc.

round(3.4) % 3
round(3.5) % 4
round(-2.5) % -3
round(123.456, 2) % 123.46 (Excel-compat)
round(123.456, -1) % 120 (Excel-compat)
  • floor — Round toward negative infinity.
  • nthroot — Real n-th root of an array.