RoundingMode.UNNECESSARY

Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary. If this rounding mode is specified on an operation that yields an inexact result, an {@code ArithmeticException} is thrown. <p>Example: <table border> <caption><b>Rounding mode UNNECESSARY Examples</b></caption> <tr valign=top><th>Input Number</th> <th>Input rounded to one digit<br> with {@code UNNECESSARY} rounding <tr align=right><td>5.5</td> <td>throw {@code ArithmeticException}</td> <tr align=right><td>2.5</td> <td>throw {@code ArithmeticException}</td> <tr align=right><td>1.6</td> <td>throw {@code ArithmeticException}</td> <tr align=right><td>1.1</td> <td>throw {@code ArithmeticException}</td> <tr align=right><td>1.0</td> <td>1</td> <tr align=right><td>-1.0</td> <td>-1</td> <tr align=right><td>-1.1</td> <td>throw {@code ArithmeticException}</td> <tr align=right><td>-1.6</td> <td>throw {@code ArithmeticException}</td> <tr align=right><td>-2.5</td> <td>throw {@code ArithmeticException}</td> <tr align=right><td>-5.5</td> <td>throw {@code ArithmeticException}</td> </table>

class RoundingMode
static
RoundingMode UNNECESSARY;

Meta