Section: Elementary Functions
y = round(x)
where x is a multidimensional array of numerical type. The round
function preserves the type of the argument. So integer arguments
are not modified, and float arrays return float arrays as
outputs, and similarly for double arrays. The round function
is not defined for complex or dcomplex types.
round function applied to various
(numerical) arguments. For integer arguments, the round function has
no effect:
--> round(3) ans = <int32> - size: [1 1] 3 --> round(-3) ans = <int32> - size: [1 1] -3
Next, we take the round of a floating point value:
--> round(3.023f) ans = <float> - size: [1 1] 3 --> round(-2.341f) ans = <float> - size: [1 1] -2
Note that the return type is a float also. Finally, for a double
type:
--> round(4.312) ans = <double> - size: [1 1] 4 --> round(-5.32) ans = <double> - size: [1 1] -5