U N N E C E S S A R Y
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 ArithmeticException is thrown.
Example:
<table class="striped"> <caption>Rounding mode UNNECESSARY Examples</caption> <thead> <tr style="vertical-align:top"><th scope="col">Input Number</th> <th scope="col">Input rounded to one digit<br></br> with `UNNECESSARY` rounding </th></tr></thead> * <tbody style="text-align:right"> <tr><th scope="row">5.5</th> <td>throw `ArithmeticException`</td> </tr> * <tr><th scope="row">2.5</th> <td>throw `ArithmeticException`</td> </tr> * <tr><th scope="row">1.6</th> <td>throw `ArithmeticException`</td> </tr> * <tr><th scope="row">1.1</th> <td>throw `ArithmeticException`</td> </tr> * <tr><th scope="row">1.0</th> <td>1</td> </tr> * <tr><th scope="row">-1.0</th> <td>-1</td> </tr> * <tr><th scope="row">-1.1</th> <td>throw `ArithmeticException`</td> </tr> * <tr><th scope="row">-1.6</th> <td>throw `ArithmeticException`</td> </tr> * <tr><th scope="row">-2.5</th> <td>throw `ArithmeticException`</td> </tr> * <tr><th scope="row">-5.5</th> <td>throw `ArithmeticException`</td> </tr></tbody> * </table> *