Function Round(x[, decimals])

# Round

Round(
x,            ! (input) numerical expression
decimals      ! (optional) integer expression
)


## Arguments

x

A scalar numerical expression.

decimals (optional)

An integer expression.

## Return Value

The function Round returns the integer value nearest to x. In the presence of the optional argument n the function Round returns the value of x rounded to n decimal places left ($$decimals < 0$$) or right ($$decimals > 0$$) of the decimal point.

Note

• The function Round can be used in constraints of nonlinear mathematical programs. However, nonlinear solvers may experience convergence problems around the discontinuities of the Round function.

• When the numerical expression contains a unit, the function Round will first convert the expression to that unit, before evaluating the function itself. See also the option rounding compatibility in the option category backward compatibility.

The functions Precision, Ceil, Floor, Trunc. Arithmetic functions are discussed in full detail in Arithmetic Functions of the Language Reference.