Rounding Types

Rounding on Number and BigNumber data type fields is based on Java Rounding Mode

By default, rounding mode Half Even is used this Rounding mode will round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.

Example: Rounding from 1 to 0 digits
5.5 → 6
2.5 → 2
-2.5 → -2
-5.5 → -6

Unnecessary

Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary. This mode will throw an error when you try to reduce the precision of a number

Ceiling

Rounding mode to round towards positive infinity.

Down

Rounding mode to round towards zero.

Floor

Rounding mode to round towards negative infinity.

Half Down

Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.

Half Even

Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.

Half Up

Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.

Up

Rounding mode to round away from zero.

Examples

Input Number Up Down Ceiling Floor Half Up Half Down Half Even Unnecessary

5.5

6

5

6

5

6

5

6

throw ArithmeticException

2.5

3

2

3

2

3

2

2

throw ArithmeticException

1.6

2

1

2

1

2

2

2

throw ArithmeticException

1.1

2

1

2

1

1

1

1

throw ArithmeticException

1.0

1

1

1

1

1

1

1

1

-1.0

-1

-1

-1

-1

-1

-1

-1

-1

-1.1

-2

-1

-1

-2

-1

-1

-1

throw ArithmeticException

-1.6

-2

-1

-1

-2

-2

-2

-2

throw ArithmeticException

-2.5

-3

-2

-3

-3

-3

-2

-2

throw ArithmeticException

-5.5

-6

-5

-6

-6

-6

-5

-6

throw ArithmeticException