|
1 | 1 | /* |
2 | | - * Copyright (c) 2003,2017, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2003,2020, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
87 | 87 | * ({@link BigDecimal#ROUND_UP}, {@link BigDecimal#ROUND_DOWN}, |
88 | 88 | * etc. ). |
89 | 89 | * |
| 90 | + * @apiNote |
| 91 | + * Five of the rounding modes declared in this class correspond to |
| 92 | + * rounding direction attributes defined in the <cite>IEEE Standard |
| 93 | + * for Floating-Point Arithmetic</cite>, IEEE 754-2019. Where present, |
| 94 | + * this correspondence will be noted in the documentation of the |
| 95 | + * particular constant. |
| 96 | + * |
90 | 97 | * @see BigDecimal |
91 | 98 | * @see MathContext |
92 | 99 | * @author Josh Bloch |
@@ -130,6 +137,8 @@ public enum RoundingMode { |
130 | 137 | * Rounding mode to round towards zero. Never increments the digit |
131 | 138 | * prior to a discarded fraction (i.e., truncates). Note that this |
132 | 139 | * rounding mode never increases the magnitude of the calculated value. |
| 140 | + * This mode corresponds to the IEEE 754-2019 rounding |
| 141 | + * attribute roundTowardZero. |
133 | 142 | * |
134 | 143 | *<p>Example: |
135 | 144 | *<table class="striped"> |
@@ -159,6 +168,8 @@ public enum RoundingMode { |
159 | 168 | * result is positive, behaves as for {@code RoundingMode.UP}; |
160 | 169 | * if negative, behaves as for {@code RoundingMode.DOWN}. Note |
161 | 170 | * that this rounding mode never decreases the calculated value. |
| 171 | + * This mode corresponds to the IEEE 754-2019 rounding |
| 172 | + * attribute roundTowardPositive. |
162 | 173 | * |
163 | 174 | *<p>Example: |
164 | 175 | *<table class="striped"> |
@@ -188,6 +199,8 @@ public enum RoundingMode { |
188 | 199 | * result is positive, behave as for {@code RoundingMode.DOWN}; |
189 | 200 | * if negative, behave as for {@code RoundingMode.UP}. Note that |
190 | 201 | * this rounding mode never increases the calculated value. |
| 202 | + * This mode corresponds to the IEEE 754-2019 rounding |
| 203 | + * attribute roundTowardNegative. |
191 | 204 | * |
192 | 205 | *<p>Example: |
193 | 206 | *<table class="striped"> |
@@ -219,6 +232,8 @@ public enum RoundingMode { |
219 | 232 | * fraction is ≥ 0.5; otherwise, behaves as for |
220 | 233 | * {@code RoundingMode.DOWN}. Note that this is the rounding |
221 | 234 | * mode commonly taught at school. |
| 235 | + * This mode corresponds to the IEEE 754-2019 rounding |
| 236 | + * attribute roundTiesToAway. |
222 | 237 | * |
223 | 238 | *<p>Example: |
224 | 239 | *<table class="striped"> |
@@ -286,6 +301,8 @@ public enum RoundingMode { |
286 | 301 | * chiefly used in the USA. This rounding mode is analogous to |
287 | 302 | * the rounding policy used for {@code float} and {@code double} |
288 | 303 | * arithmetic in Java. |
| 304 | + * This mode corresponds to the IEEE 754-2019 rounding |
| 305 | + * attribute roundTiesToEven. |
289 | 306 | * |
290 | 307 | *<p>Example: |
291 | 308 | *<table class="striped"> |
|