Round to nearest decimal or integer

Syntax and Description

round(X) rounds each element of X to the nearest integer. In the case of a tie, where an element has a fractional part of exactly 0.5, the round function rounds away from zero to the integer with larger magnitude.
round(X,N) rounds to N digits:
  • N > 0: round to N digits to the right of the decimal point.
  • N = 0: round to the nearest integer.
  • N < 0: round to N digits to the left of the decimal point.

Back to functions