ceiling
), the next smallest (
floor
), or the next
integer closer to zero (
trunc
).
ceiling(x) floor(x) trunc(x)
NA
s) are allowed.
bdVector
of the same length and storage mode as
x
.
ceiling(x)
contains the smallest integers >=
x
.
floor(x)
contains the largest integers <=
x
.
trunc(x)
contains the closest integers to
x
between
x
and
0
, inclusive, e.g.,
trunc(1.5)
is 1,
and
trunc(-1.5)
is
--1
.
trunc
is like
floor
for positive values and like
ceiling
for
negative values.
This function will be used as the default method for classes that do not inherit a specific method for the function or for the Math group of functions. The result will retain the class and the attributes. If this behavior is not appropriate, the designer of the class should provide a method for the function or for the Math group
These are members of the
Math
group of generic functions.
ceiling(c(-1.9, -1.1, 1.1, 1.9)) # returns c(-1,-1,2,2) floor(c(-1.9, -1.1, 1.1, 1.9)) # returns c(-2,-2,1,1) trunc(c(-1.9, -1.1, 1.1, 1.9)) # returns c(-1,-1,1,1)