--- old/src/java.base/share/classes/java/math/RoundingMode.java 2017-05-05 15:25:42.719414006 -0700 +++ new/src/java.base/share/classes/java/math/RoundingMode.java 2017-05-05 15:25:42.591408416 -0700 @@ -51,8 +51,9 @@ * proper {@code MathContext}. A summary table showing the results * of these rounding operations for all rounding modes appears below. * - * + *
* + * * * @@ -64,6 +65,8 @@ * * * + * + * * * * @@ -75,7 +78,8 @@ * * * - *
Summary of Rounding Operations Under Different Rounding Modes
Result of rounding input to one digit with the given * rounding mode
{@code HALF_DOWN}{@code HALF_EVEN}{@code UNNECESSARY}
5.5 6 5 6 5 6 5 6 throw {@code ArithmeticException}
2.5 3 2 3 2 3 2 2 throw {@code ArithmeticException}
-1.6 -2 -1 -1 -2 -2 -2 -2 throw {@code ArithmeticException}
-2.5 -3 -2 -2 -3 -3 -2 -2 throw {@code ArithmeticException}
-5.5 -6 -5 -5 -6 -6 -5 -6 throw {@code ArithmeticException}
+ * + * * * *

This {@code enum} is intended to replace the integer-based @@ -100,10 +104,13 @@ * value. * *

Example: - * + *
* + * * * + * * * * @@ -114,6 +121,7 @@ * * * + * *
Rounding mode UP Examples
Input NumberInput rounded to one digit
with {@code UP} rounding + *
5.5 6
2.5 3
1.6 2
-1.6 -2
-2.5 -3
-5.5 -6
*/ UP(BigDecimal.ROUND_UP), @@ -124,10 +132,13 @@ * rounding mode never increases the magnitude of the calculated value. * *

Example: - * + *
* + * * * + * * * * @@ -138,6 +149,7 @@ * * * + * *
Rounding mode DOWN Examples
Input NumberInput rounded to one digit
with {@code DOWN} rounding + *
5.5 5
2.5 2
1.6 1
-1.6 -1
-2.5 -2
-5.5 -5
*/ DOWN(BigDecimal.ROUND_DOWN), @@ -149,10 +161,13 @@ * that this rounding mode never decreases the calculated value. * *

Example: - * + *
* + * * * + * * * * @@ -163,6 +178,7 @@ * * * + * *
Rounding mode CEILING Examples
Input NumberInput rounded to one digit
with {@code CEILING} rounding + *
5.5 6
2.5 3
1.6 2
-1.6 -1
-2.5 -2
-5.5 -5
*/ CEILING(BigDecimal.ROUND_CEILING), @@ -174,10 +190,13 @@ * this rounding mode never increases the calculated value. * *

Example: - * + *
* + * * * + * * * * @@ -188,6 +207,7 @@ * * * + * *
Rounding mode FLOOR Examples
Input NumberInput rounded to one digit
with {@code FLOOR} rounding + *
5.5 5
2.5 2
1.6 1
-1.6 -2
-2.5 -3
-5.5 -6
*/ FLOOR(BigDecimal.ROUND_FLOOR), @@ -201,10 +221,13 @@ * mode commonly taught at school. * *

Example: - * + *
* + * * * + * * * * @@ -215,6 +238,7 @@ * * * + * *
Rounding mode HALF_UP Examples
Input NumberInput rounded to one digit
with {@code HALF_UP} rounding + *
5.5 6
2.5 3
1.6 2
-1.6 -2
-2.5 -3
-5.5 -6
*/ HALF_UP(BigDecimal.ROUND_HALF_UP), @@ -227,10 +251,13 @@ * {@code RoundingMode.DOWN}. * *

Example: - * + *
* + * * * + * * * * @@ -241,6 +268,7 @@ * * * + * *
Rounding mode HALF_DOWN Examples
Input NumberInput rounded to one digit
with {@code HALF_DOWN} rounding + *
5.5 5
2.5 2
1.6 2
-1.6 -2
-2.5 -2
-5.5 -5
*/ HALF_DOWN(BigDecimal.ROUND_HALF_DOWN), @@ -260,10 +288,13 @@ * arithmetic in Java. * *

Example: - * + *
* + * * * + * * * * @@ -274,6 +305,7 @@ * * * + * *
Rounding mode HALF_EVEN Examples
Input NumberInput rounded to one digit
with {@code HALF_EVEN} rounding + *
5.5 6
2.5 2
1.6 2
-1.6 -2
-2.5 -2
-5.5 -6
*/ HALF_EVEN(BigDecimal.ROUND_HALF_EVEN), @@ -284,10 +316,13 @@ * specified on an operation that yields an inexact result, an * {@code ArithmeticException} is thrown. *

Example: - * + *
* + * * * + * * * * @@ -298,6 +333,7 @@ * * * + * *
Rounding mode UNNECESSARY Examples
Input NumberInput rounded to one digit
with {@code UNNECESSARY} rounding + *
5.5 throw {@code ArithmeticException}
2.5 throw {@code ArithmeticException}
1.6 throw {@code ArithmeticException}
-1.6 throw {@code ArithmeticException}
-2.5 throw {@code ArithmeticException}
-5.5 throw {@code ArithmeticException}
*/ UNNECESSARY(BigDecimal.ROUND_UNNECESSARY);