Enumeration

enum RoundingMode

public enum RoundingMode {
    | CEILING
    | DOWN
    | FLOOR
    | HALF_EVEN
    | HALF_UP
    | UP
}

Specifies the enumeration class of rounding rules, including six rounding rules. In addition to the five rounding rules of floating-point numbers specified in IEEE 754, the most commonly used rounding off rule is provided.

Decimal numberUPDOWNCEILINGFLOORHALF_UPHALF_EVEN
7.5878788
4.5545454
-1.1-2-1-1-2-1-1
-4.5-5-4-4-5-5-4
-7.5-8-7-7-8-8-8

CEILING

CEILING

Description: Rounds towards positive infinity.

DOWN

DOWN

Description: Rounds towards zero.

FLOOR

FLOOR

Description: Rounds towards negative infinity.

HALF_EVEN

HALF_EVEN

Description: Rounds a number using the rounding half to even method, which is also called "banker's rounding".

HALF_UP

HALF_UP

Description: Rounds off a number.

UP

UP

Description: Rounds away from zero.