103 * determines how any discarded trailing digits affect the returned
104 * result.
105 *
106 * <p>For all arithmetic operators , the operation is carried out as
107 * though an exact intermediate result were first calculated and then
108 * rounded to the number of digits specified by the precision setting
109 * (if necessary), using the selected rounding mode. If the exact
110 * result is not returned, some digit positions of the exact result
111 * are discarded. When rounding increases the magnitude of the
112 * returned result, it is possible for a new digit position to be
113 * created by a carry propagating to a leading {@literal "9"} digit.
114 * For example, rounding the value 999.9 to three digits rounding up
115 * would be numerically equal to one thousand, represented as
116 * 100×10<sup>1</sup>. In such cases, the new {@literal "1"} is
117 * the leading digit position of the returned result.
118 *
119 * <p>Besides a logical exact result, each arithmetic operation has a
120 * preferred scale for representing a result. The preferred
121 * scale for each operation is listed in the table below.
122 *
123 * <table border>
124 * <caption><b>Preferred Scales for Results of Arithmetic Operations
125 * </b></caption>
126 * <tr><th>Operation</th><th>Preferred Scale of Result</th></tr>
127 * <tr><td>Add</td><td>max(addend.scale(), augend.scale())</td>
128 * <tr><td>Subtract</td><td>max(minuend.scale(), subtrahend.scale())</td>
129 * <tr><td>Multiply</td><td>multiplier.scale() + multiplicand.scale()</td>
130 * <tr><td>Divide</td><td>dividend.scale() - divisor.scale()</td>
131 * <tr><td>Square root</td><td>radicand.scale()/2</td>
132 * </table>
133 *
134 * These scales are the ones used by the methods which return exact
135 * arithmetic results; except that an exact divide may have to use a
136 * larger scale since the exact result may have more digits. For
137 * example, {@code 1/32} is {@code 0.03125}.
138 *
139 * <p>Before rounding, the scale of the logical exact intermediate
140 * result is the preferred scale for that operation. If the exact
141 * numerical result cannot be represented in {@code precision}
142 * digits, rounding selects the set of digits to return and the scale
143 * of the result is reduced from the scale of the intermediate result
144 * to the least scale which can represent the {@code precision}
145 * digits actually returned. If the exact result can be represented
146 * with at most {@code precision} digits, the representation
147 * of the result with the scale closest to the preferred scale is
148 * returned. In particular, an exactly representable quotient may be
149 * represented in fewer than {@code precision} digits by removing
150 * trailing zeros and decreasing the scale. For example, rounding to
151 * three digits using the {@linkplain RoundingMode#FLOOR floor}
|
103 * determines how any discarded trailing digits affect the returned
104 * result.
105 *
106 * <p>For all arithmetic operators , the operation is carried out as
107 * though an exact intermediate result were first calculated and then
108 * rounded to the number of digits specified by the precision setting
109 * (if necessary), using the selected rounding mode. If the exact
110 * result is not returned, some digit positions of the exact result
111 * are discarded. When rounding increases the magnitude of the
112 * returned result, it is possible for a new digit position to be
113 * created by a carry propagating to a leading {@literal "9"} digit.
114 * For example, rounding the value 999.9 to three digits rounding up
115 * would be numerically equal to one thousand, represented as
116 * 100×10<sup>1</sup>. In such cases, the new {@literal "1"} is
117 * the leading digit position of the returned result.
118 *
119 * <p>Besides a logical exact result, each arithmetic operation has a
120 * preferred scale for representing a result. The preferred
121 * scale for each operation is listed in the table below.
122 *
123 * <table class="plain">
124 * <caption><b>Preferred Scales for Results of Arithmetic Operations
125 * </b></caption>
126 * <thead>
127 * <tr><th>Operation</th><th>Preferred Scale of Result</th></tr>
128 * </thead>
129 * <tbody>
130 * <tr><td>Add</td><td>max(addend.scale(), augend.scale())</td>
131 * <tr><td>Subtract</td><td>max(minuend.scale(), subtrahend.scale())</td>
132 * <tr><td>Multiply</td><td>multiplier.scale() + multiplicand.scale()</td>
133 * <tr><td>Divide</td><td>dividend.scale() - divisor.scale()</td>
134 * <tr><td>Square root</td><td>radicand.scale()/2</td>
135 * </tbody>
136 * </table>
137 *
138 * These scales are the ones used by the methods which return exact
139 * arithmetic results; except that an exact divide may have to use a
140 * larger scale since the exact result may have more digits. For
141 * example, {@code 1/32} is {@code 0.03125}.
142 *
143 * <p>Before rounding, the scale of the logical exact intermediate
144 * result is the preferred scale for that operation. If the exact
145 * numerical result cannot be represented in {@code precision}
146 * digits, rounding selects the set of digits to return and the scale
147 * of the result is reduced from the scale of the intermediate result
148 * to the least scale which can represent the {@code precision}
149 * digits actually returned. If the exact result can be represented
150 * with at most {@code precision} digits, the representation
151 * of the result with the scale closest to the preferred scale is
152 * returned. In particular, an exactly representable quotient may be
153 * represented in fewer than {@code precision} digits by removing
154 * trailing zeros and decreasing the scale. For example, rounding to
155 * three digits using the {@linkplain RoundingMode#FLOOR floor}
|