roundingMode

Specifies rounding behavior *

Values

ValueMeaning
UP

Round upwards, e.g. 3.1 up to 4.

DOWN

Round downwards, e.g. 3.9 down to 3.

HALF_UP

Round to nearest number, half way between round up, e.g. 3.5 to 4.

HALF_DOWN

Round to nearest number, half way between round dow, e.g. 3.5 to 3.

HALF_EVEN

Round to nearest number, half way between round to even number, e.g. 3.5 to 4.

HALF_ODD

Round to nearest number, half way between round to odd number, e.g. 3.5 to 3.

HALF_TO_ZERO

Round to nearest number, half way between round towards zero, e.g. -3.5 to -3.

HALF_FROM_ZERO

Round to nearest number, half way between round away from zero, e.g. -3.5 to -4.

UNNECESSARY

Throw exception if rounding would be necessary

Meta