Round#
Round to the nearest decimal or integer
Y = round(
X
)
rounds each element of X
to the nearest integer. In cases where rounding is equally likely, i.e., when the decimal part of an element is 0.5
(within rounding error), the round
function rounds away from zero to the nearest integer with a larger magnitude.
Y = round(
X
,
N
)
rounds to N
decimal places:
N > 0
: Rounds to theN
th decimal place to the right of the decimal point.N = 0
: Rounds to the nearest integer.N < 0
: Rounds to theN
th decimal place to the left of the decimal point.
Y = round(
X
,
N
,
type
)
specifies the type of rounding. Specify "significant"
to round to N
significant digits (counting from the leftmost digit). In this case, N
must be a positive integer.
Y = round(
___
,TieBreaker=
direction
)
rounds the value according to the direction specified by direction
. This parameter is used after any combination of input parameters in the above syntax.
Y = round(
t
)
rounds each element of the duration
array t
to the nearest second.
Y = round(
t
,
unit
)
rounds each element of t
to the nearest number in the specified unit of time.
Ceil#
Round towards positive infinity
Y = ceil(
X
)
rounds each element of X
to the nearest integer greater than or equal to that element.
Y = ceil(
t
)
rounds each element of the duration
array t
to the nearest second greater than or equal to that element.
Y = ceil(
t
,
unit
)
rounds each element of t
to the nearest number greater than or equal to that element (using the specified time unit).
Floor#
Round towards negative infinity
Y = floor(
X
)
rounds each element of X
to the nearest integer less than or equal to that element.
Y = floor(
t
)
rounds each element of the duration
array t
to the nearest second less than or equal to that element.
Y = floor(
t
,
unit
)
rounds each element of t
to the nearest number less than or equal to that element (using the specified time unit).
Fix#
Round towards zero
Y = fix(
X
)
rounds each element of X
towards zero to the nearest integer. This operation effectively truncates the decimal part of each number in X
to convert them to integers:
- For positive numbers,
fix
behaves likefloor
. - For negative numbers,
fix
behaves likeceil
.