mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8268224: Cleanup references to "strictfp" in core lib comments
Reviewed-by: jrose
This commit is contained in:
parent
516e60a7ee
commit
05df1727b5
2 changed files with 47 additions and 97 deletions
|
@ -1794,9 +1794,6 @@ public final class Math {
|
|||
infiniteB && a == 0.0 ) {
|
||||
return Double.NaN;
|
||||
}
|
||||
// Store product in a double field to cause an
|
||||
// overflow even if non-strictfp evaluation is being
|
||||
// used.
|
||||
double product = a * b;
|
||||
if (Double.isInfinite(product) && !infiniteA && !infiniteB) {
|
||||
// Intermediate overflow; might cause a
|
||||
|
@ -2662,20 +2659,17 @@ public final class Math {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns {@code d} ×
|
||||
* 2<sup>{@code scaleFactor}</sup> rounded as if performed
|
||||
* by a single correctly rounded floating-point multiply to a
|
||||
* member of the double value set. See the Java
|
||||
* Language Specification for a discussion of floating-point
|
||||
* value sets. If the exponent of the result is between {@link
|
||||
* Double#MIN_EXPONENT} and {@link Double#MAX_EXPONENT}, the
|
||||
* answer is calculated exactly. If the exponent of the result
|
||||
* would be larger than {@code Double.MAX_EXPONENT}, an
|
||||
* infinity is returned. Note that if the result is subnormal,
|
||||
* precision may be lost; that is, when {@code scalb(x, n)}
|
||||
* is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
|
||||
* <i>x</i>. When the result is non-NaN, the result has the same
|
||||
* sign as {@code d}.
|
||||
* Returns {@code d} × 2<sup>{@code scaleFactor}</sup>
|
||||
* rounded as if performed by a single correctly rounded
|
||||
* floating-point multiply. If the exponent of the result is
|
||||
* between {@link Double#MIN_EXPONENT} and {@link
|
||||
* Double#MAX_EXPONENT}, the answer is calculated exactly. If the
|
||||
* exponent of the result would be larger than {@code
|
||||
* Double.MAX_EXPONENT}, an infinity is returned. Note that if
|
||||
* the result is subnormal, precision may be lost; that is, when
|
||||
* {@code scalb(x, n)} is subnormal, {@code scalb(scalb(x, n),
|
||||
* -n)} may not equal <i>x</i>. When the result is non-NaN, the
|
||||
* result has the same sign as {@code d}.
|
||||
*
|
||||
* <p>Special cases:
|
||||
* <ul>
|
||||
|
@ -2693,9 +2687,7 @@ public final class Math {
|
|||
*/
|
||||
public static double scalb(double d, int scaleFactor) {
|
||||
/*
|
||||
* This method does not need to be declared strictfp to
|
||||
* compute the same correct result on all platforms. When
|
||||
* scaling up, it does not matter what order the
|
||||
* When scaling up, it does not matter what order the
|
||||
* multiply-store operations are done; the result will be
|
||||
* finite or overflow regardless of the operation ordering.
|
||||
* However, to get the correct result when scaling down, a
|
||||
|
@ -2709,25 +2701,7 @@ public final class Math {
|
|||
* by 2 ^ (scaleFactor % n) and then multiplying several
|
||||
* times by 2^n as needed where n is the exponent of number
|
||||
* that is a convenient power of two. In this way, at most one
|
||||
* real rounding error occurs. If the double value set is
|
||||
* being used exclusively, the rounding will occur on a
|
||||
* multiply. If the double-extended-exponent value set is
|
||||
* being used, the products will (perhaps) be exact but the
|
||||
* stores to d are guaranteed to round to the double value
|
||||
* set.
|
||||
*
|
||||
* It is _not_ a valid implementation to first multiply d by
|
||||
* 2^MIN_EXPONENT and then by 2 ^ (scaleFactor %
|
||||
* MIN_EXPONENT) since even in a strictfp program double
|
||||
* rounding on underflow could occur; e.g. if the scaleFactor
|
||||
* argument was (MIN_EXPONENT - n) and the exponent of d was a
|
||||
* little less than -(MIN_EXPONENT - n), meaning the final
|
||||
* result would be subnormal.
|
||||
*
|
||||
* Since exact reproducibility of this method can be achieved
|
||||
* without any undue performance burden, there is no
|
||||
* compelling reason to allow double rounding on underflow in
|
||||
* scalb.
|
||||
* real rounding error occurs.
|
||||
*/
|
||||
|
||||
// magnitude of a power of two so large that scaling a finite
|
||||
|
@ -2769,20 +2743,17 @@ public final class Math {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns {@code f} ×
|
||||
* 2<sup>{@code scaleFactor}</sup> rounded as if performed
|
||||
* by a single correctly rounded floating-point multiply to a
|
||||
* member of the float value set. See the Java
|
||||
* Language Specification for a discussion of floating-point
|
||||
* value sets. If the exponent of the result is between {@link
|
||||
* Float#MIN_EXPONENT} and {@link Float#MAX_EXPONENT}, the
|
||||
* answer is calculated exactly. If the exponent of the result
|
||||
* would be larger than {@code Float.MAX_EXPONENT}, an
|
||||
* infinity is returned. Note that if the result is subnormal,
|
||||
* precision may be lost; that is, when {@code scalb(x, n)}
|
||||
* is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
|
||||
* <i>x</i>. When the result is non-NaN, the result has the same
|
||||
* sign as {@code f}.
|
||||
* Returns {@code f} × 2<sup>{@code scaleFactor}</sup>
|
||||
* rounded as if performed by a single correctly rounded
|
||||
* floating-point multiply. If the exponent of the result is
|
||||
* between {@link Float#MIN_EXPONENT} and {@link
|
||||
* Float#MAX_EXPONENT}, the answer is calculated exactly. If the
|
||||
* exponent of the result would be larger than {@code
|
||||
* Float.MAX_EXPONENT}, an infinity is returned. Note that if the
|
||||
* result is subnormal, precision may be lost; that is, when
|
||||
* {@code scalb(x, n)} is subnormal, {@code scalb(scalb(x, n),
|
||||
* -n)} may not equal <i>x</i>. When the result is non-NaN, the
|
||||
* result has the same sign as {@code f}.
|
||||
*
|
||||
* <p>Special cases:
|
||||
* <ul>
|
||||
|
@ -2814,9 +2785,7 @@ public final class Math {
|
|||
* exponent range and + float -> double conversion is exact
|
||||
* the multiplication below will be exact. Therefore, the
|
||||
* rounding that occurs when the double product is cast to
|
||||
* float will be the correctly rounded float result. Since
|
||||
* all operations other than the final multiply will be exact,
|
||||
* it is not necessary to declare this method strictfp.
|
||||
* float will be the correctly rounded float result.
|
||||
*/
|
||||
return (float)((double)f*powerOfTwoD(scaleFactor));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue