# rounding types

#### Rounding Types

Rounding on Number and BigNumber data type fields is based on [Java Rounding Mode](https://docs.oracle.com/javase/8/docs/api/java/math/RoundingMode.html)

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 |

Last updated 2025-09-04 18:23:47 +0200


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-shaper-1.21/index-2/snippets/rounding-types.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
