|
52 | 52 | *
|
53 | 53 | * <p>The {@code BigDecimal} class gives its user complete control
|
54 | 54 | * over rounding behavior. If no rounding mode is specified and the
|
55 |
| - * exact result cannot be represented, an exception is thrown; |
56 |
| - * otherwise, calculations can be carried out to a chosen precision |
57 |
| - * and rounding mode by supplying an appropriate {@link MathContext} |
58 |
| - * object to the operation. In either case, eight <em>rounding |
59 |
| - * modes</em> are provided for the control of rounding. Using the |
60 |
| - * integer fields in this class (such as {@link #ROUND_HALF_UP}) to |
61 |
| - * represent rounding mode is deprecated; the enumeration values |
62 |
| - * of the {@code RoundingMode} {@code enum}, (such as {@link |
63 |
| - * RoundingMode#HALF_UP}) should be used instead. |
| 55 | + * exact result cannot be represented, an {@code ArithmeticException} |
| 56 | + * is thrown; otherwise, calculations can be carried out to a chosen |
| 57 | + * precision and rounding mode by supplying an appropriate {@link |
| 58 | + * MathContext} object to the operation. In either case, eight |
| 59 | + * <em>rounding modes</em> are provided for the control of rounding. |
| 60 | + * Using the integer fields in this class (such as {@link |
| 61 | + * #ROUND_HALF_UP}) to represent rounding mode is deprecated; the |
| 62 | + * enumeration values of the {@code RoundingMode} {@code enum}, (such |
| 63 | + * as {@link RoundingMode#HALF_UP}) should be used instead. |
64 | 64 | *
|
65 | 65 | * <p>When a {@code MathContext} object is supplied with a precision
|
66 | 66 | * setting of 0 (for example, {@link MathContext#UNLIMITED}),
|
|
103 | 103 | * the exact result has more digits (perhaps infinitely many in the
|
104 | 104 | * case of division and square root) than the number of digits returned.
|
105 | 105 | *
|
106 |
| - * First, the |
107 |
| - * total number of digits to return is specified by the |
| 106 | + * First, the total number of digits to return is specified by the |
108 | 107 | * {@code MathContext}'s {@code precision} setting; this determines
|
109 | 108 | * the result's <i>precision</i>. The digit count starts from the
|
110 | 109 | * leftmost nonzero digit of the exact result. The rounding mode
|
|
194 | 193 | * {@code BigDecimal} created from the operand by moving the decimal
|
195 | 194 | * point a specified distance in the specified direction.
|
196 | 195 | *
|
| 196 | + * <p>As a 32-bit integer, the set of values for the scale is large, |
| 197 | + * but bounded. If the scale of a result would exceed the range of a |
| 198 | + * 32-bit integer, either by overflow or underflow, the operation may |
| 199 | + * throw an {@code ArithmeticException}. |
| 200 | + * |
197 | 201 | * <p>For the sake of brevity and clarity, pseudo-code is used
|
198 | 202 | * throughout the descriptions of {@code BigDecimal} methods. The
|
199 | 203 | * pseudo-code expression {@code (i + j)} is shorthand for "a
|
|
208 | 212 | * {@code BigDecimal} value; for example [19, 2] is the
|
209 | 213 | * {@code BigDecimal} numerically equal to 0.19 having a scale of 2.
|
210 | 214 | *
|
211 |
| - * |
212 | 215 | * <p>All methods and constructors for this class throw
|
213 | 216 | * {@code NullPointerException} when passed a {@code null} object
|
214 | 217 | * reference for any input parameter.
|
|
0 commit comments