These functions ignore which neighbor is nearer:
round_ceiling()always rounds up.round_floor()always rounds down.round_trunc()always rounds toward zero.round_anti_trunc()always rounds away from zero. A value that already sits on the rounding grid stays where it is, so0stays0. This is what Excel'sROUNDUP(), Java'sRoundingMode.UP, and Python'sdecimal.ROUND_UPdo.anti_trunc()is the counterpart oftrunc(): it rounds a number to the nearest whole number away from zero. Whole numbers stay unchanged.
Usage
round_ceiling(x, digits = 0L)
round_floor(x, digits = 0L)
round_trunc(x, digits = 0L)
anti_trunc(x)
round_anti_trunc(x, digits = 0L)Details
round_ceiling(), round_floor(), and round_trunc() generalize
ceiling(), floor(), and trunc() to any number of decimal
places, and round_anti_trunc() generalizes anti_trunc(). With the
default digits = 0, each equals its base counterpart.
round_trunc() is round_floor() for positive and round_ceiling() for
negative numbers; round_anti_trunc() is the reverse.
All of these apply the floating-point tolerance described in
round_up(), so that round_ceiling(0.28, 2) is 0.28 although
0.28 * 100 is stored as 28.000000000000004.
See also
round_up() and round_down() round to the nearest number
and decide ties by a fixed direction.