Rounding mode to round towards "nearest neighbor"
unless both neighbors are equidistant, in which case round up.
Behaves as for RoundingMode.UP if the discarded
fraction is ≥ 0.5; otherwise, behaves as for
RoundingMode.DOWN. Note that this is the rounding
mode commonly taught at school.
Example:
| Input Number | Input rounded to one digit with HALF_UP rounding
|
|---|---|
| 5.5 | 6 |
| 2.5 | 3 |
| 1.6 | 2 |
| 1.1 | 1 |
| 1.0 | 1 |
| -1.0 | -1 |
| -1.1 | -1 |
| -1.6 | -2 |
| -2.5 | -3 |
| -5.5 | -6 |
Diagram: Context