|
55 | 55 | * <p>The quality of implementation specifications concern two |
56 | 56 | * properties, accuracy of the returned result and monotonicity of the |
57 | 57 | * method. Accuracy of the floating-point {@code Math} methods is |
58 | | - * measured in terms of <i>ulps</i>, units in the last place. For a |
59 | | - * given floating-point format, an {@linkplain #ulp(double) ulp} of a |
60 | | - * specific real number value is the distance between the two |
61 | | - * floating-point values bracketing that numerical value. When |
62 | | - * discussing the accuracy of a method as a whole rather than at a |
63 | | - * specific argument, the number of ulps cited is for the worst-case |
64 | | - * error at any argument. If a method always has an error less than |
65 | | - * 0.5 ulps, the method always returns the floating-point number |
66 | | - * nearest the exact result; such a method is <i>correctly |
67 | | - * rounded</i>. A correctly rounded method is generally the best a |
68 | | - * floating-point approximation can be; however, it is impractical for |
69 | | - * many floating-point methods to be correctly rounded. Instead, for |
70 | | - * the {@code Math} class, a larger error bound of 1 or 2 ulps is |
71 | | - * allowed for certain methods. Informally, with a 1 ulp error bound, |
72 | | - * when the exact result is a representable number, the exact result |
73 | | - * should be returned as the computed result; otherwise, either of the |
74 | | - * two floating-point values which bracket the exact result may be |
75 | | - * returned. For exact results large in magnitude, one of the |
76 | | - * endpoints of the bracket may be infinite. Besides accuracy at |
77 | | - * individual arguments, maintaining proper relations between the |
78 | | - * method at different arguments is also important. Therefore, most |
79 | | - * methods with more than 0.5 ulp errors are required to be |
80 | | - * <i>semi-monotonic</i>: whenever the mathematical function is |
81 | | - * non-decreasing, so is the floating-point approximation, likewise, |
82 | | - * whenever the mathematical function is non-increasing, so is the |
83 | | - * floating-point approximation. Not all approximations that have 1 |
84 | | - * ulp accuracy will automatically meet the monotonicity requirements. |
| 58 | + * measured in terms of <dfn>{@index ulp}s</dfn>, {@index "units in |
| 59 | + * the last place"}. For a given floating-point format, an |
| 60 | + * {@linkplain #ulp(double) ulp} of a specific real number value is |
| 61 | + * the distance between the two floating-point values bracketing that |
| 62 | + * numerical value. When discussing the accuracy of a method as a |
| 63 | + * whole rather than at a specific argument, the number of ulps cited |
| 64 | + * is for the worst-case error at any argument. If a method always |
| 65 | + * has an error less than 0.5 ulps, the method always returns the |
| 66 | + * floating-point number nearest the exact result; such a method is |
| 67 | + * <dfn>correctly rounded</dfn>. A {@index "correctly rounded"} |
| 68 | + * method is generally the best a floating-point approximation can be; |
| 69 | + * however, it is impractical for many floating-point methods to be |
| 70 | + * correctly rounded. Instead, for the {@code Math} class, a larger |
| 71 | + * error bound of 1 or 2 ulps is allowed for certain methods. |
| 72 | + * Informally, with a 1 ulp error bound, when the exact result is a |
| 73 | + * representable number, the exact result should be returned as the |
| 74 | + * computed result; otherwise, either of the two floating-point values |
| 75 | + * which bracket the exact result may be returned. For exact results |
| 76 | + * large in magnitude, one of the endpoints of the bracket may be |
| 77 | + * infinite. Besides accuracy at individual arguments, maintaining |
| 78 | + * proper relations between the method at different arguments is also |
| 79 | + * important. Therefore, most methods with more than 0.5 ulp errors |
| 80 | + * are required to be <dfn>{@index "semi-monotonic"}</dfn>: whenever |
| 81 | + * the mathematical function is non-decreasing, so is the |
| 82 | + * floating-point approximation, likewise, whenever the mathematical |
| 83 | + * function is non-increasing, so is the floating-point approximation. |
| 84 | + * Not all approximations that have 1 ulp accuracy will automatically |
| 85 | + * meet the monotonicity requirements. |
85 | 86 | * |
86 | 87 | * <p> |
87 | 88 | * The platform uses signed two's complement integer arithmetic with |
88 | | - * int and long primitive types. The developer should choose |
89 | | - * the primitive type to ensure that arithmetic operations consistently |
90 | | - * produce correct results, which in some cases means the operations |
91 | | - * will not overflow the range of values of the computation. |
92 | | - * The best practice is to choose the primitive type and algorithm to avoid |
93 | | - * overflow. In cases where the size is {@code int} or {@code long} and |
94 | | - * overflow errors need to be detected, the methods whose names end with |
95 | | - * {@code Exact} throw an {@code ArithmeticException} when the results overflow. |
| 89 | + * {@code int} and {@code long} primitive types. The developer should |
| 90 | + * choose the primitive type to ensure that arithmetic operations |
| 91 | + * consistently produce correct results, which in some cases means the |
| 92 | + * operations will not overflow the range of values of the |
| 93 | + * computation. The best practice is to choose the primitive type and |
| 94 | + * algorithm to avoid overflow. In cases where the size is {@code int} |
| 95 | + * or {@code long} and overflow errors need to be detected, the |
| 96 | + * methods whose names end with {@code Exact} throw an {@code |
| 97 | + * ArithmeticException} when the results overflow. |
96 | 98 | * |
97 | 99 | * <h2><a id=Ieee754RecommendedOps>IEEE 754 Recommended |
98 | 100 | * Operations</a></h2> |
|
119 | 121 | * @see <a href="https://standards.ieee.org/ieee/754/6210/"> |
120 | 122 | * <cite>IEEE Standard for Floating-Point Arithmetic</cite></a> |
121 | 123 | * |
122 | | - * @author Joseph D. Darcy |
123 | 124 | * @since 1.0 |
124 | 125 | */ |
125 | 126 |
|
|
0 commit comments