8273346: Expand library mappings to IEEE 754 operations

Reviewed-by: bpb
This commit is contained in:
Joe Darcy 2022-06-07 16:13:42 +00:00
parent 96641c0c42
commit 5d4ea9b954
4 changed files with 156 additions and 13 deletions

View file

@ -398,6 +398,10 @@ public final class Math {
* Otherwise, the result is the {@code double} value closest to
* the true mathematical square root of the argument value.
*
* @apiNote
* This method corresponds to the squareRoot operation defined in
* IEEE 754.
*
* @param a a value.
* @return the positive square root of {@code a}.
* If the argument is NaN or less than zero, the result is NaN.
@ -481,6 +485,9 @@ public final class Math {
* that the value of {@code Math.ceil(x)} is exactly the
* value of {@code -Math.floor(-x)}.
*
* @apiNote
* This method corresponds to the roundToIntegralTowardPositive
* operation defined in IEEE 754.
*
* @param a a value.
* @return the smallest (closest to negative infinity)
@ -502,6 +509,10 @@ public final class Math {
* positive zero or negative zero, then the result is the same as
* the argument.</ul>
*
* @apiNote
* This method corresponds to the roundToIntegralTowardNegative
* operation defined in IEEE 754.
*
* @param a a value.
* @return the largest (closest to positive infinity)
* floating-point value that less than or equal to the argument
@ -523,6 +534,10 @@ public final class Math {
* <li>If the argument is NaN or an infinity or positive zero or negative
* zero, then the result is the same as the argument.</ul>
*
* @apiNote
* This method corresponds to the roundToIntegralTiesToEven
* operation defined in IEEE 754.
*
* @param a a {@code double} value.
* @return the closest floating-point value to {@code a} that is
* equal to a mathematical integer.
@ -2033,6 +2048,10 @@ public final class Math {
* argument is positive zero and the other negative zero, the
* result is positive zero.
*
* @apiNote
* This method corresponds to the maximum operation defined in
* IEEE 754.
*
* @param a an argument.
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
@ -2060,6 +2079,10 @@ public final class Math {
* argument is positive zero and the other negative zero, the
* result is positive zero.
*
* @apiNote
* This method corresponds to the maximum operation defined in
* IEEE 754.
*
* @param a an argument.
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
@ -2116,6 +2139,10 @@ public final class Math {
* one argument is positive zero and the other is negative zero,
* the result is negative zero.
*
* @apiNote
* This method corresponds to the minimum operation defined in
* IEEE 754.
*
* @param a an argument.
* @param b another argument.
* @return the smaller of {@code a} and {@code b}.
@ -2143,6 +2170,10 @@ public final class Math {
* argument is positive zero and the other is negative zero, the
* result is negative zero.
*
* @apiNote
* This method corresponds to the minimum operation defined in
* IEEE 754.
*
* @param a an argument.
* @param b another argument.
* @return the smaller of {@code a} and {@code b}.
@ -2198,7 +2229,7 @@ public final class Math {
* equivalent to ({@code a * b}) however.
*
* @apiNote This method corresponds to the fusedMultiplyAdd
* operation defined in IEEE 754-2008.
* operation defined in IEEE 754.
*
* @param a a value
* @param b a value
@ -2312,7 +2343,7 @@ public final class Math {
* equivalent to ({@code a * b}) however.
*
* @apiNote This method corresponds to the fusedMultiplyAdd
* operation defined in IEEE 754-2008.
* operation defined in IEEE 754.
*
* @param a a value
* @param b a value
@ -2692,6 +2723,10 @@ public final class Math {
* permitted to treat some NaN arguments as positive and other NaN
* arguments as negative to allow greater performance.
*
* @apiNote
* This method corresponds to the copySign operation defined in
* IEEE 754.
*
* @param magnitude the parameter providing the magnitude of the result
* @param sign the parameter providing the sign of the result
* @return a value with the magnitude of {@code magnitude}
@ -2716,6 +2751,10 @@ public final class Math {
* permitted to treat some NaN arguments as positive and other NaN
* arguments as negative to allow greater performance.
*
* @apiNote
* This method corresponds to the copySign operation defined in
* IEEE 754.
*
* @param magnitude the parameter providing the magnitude of the result
* @param sign the parameter providing the sign of the result
* @return a value with the magnitude of {@code magnitude}
@ -2739,8 +2778,12 @@ public final class Math {
* <li>If the argument is NaN or infinite, then the result is
* {@link Float#MAX_EXPONENT} + 1.
* <li>If the argument is zero or subnormal, then the result is
* {@link Float#MIN_EXPONENT} -1.
* {@link Float#MIN_EXPONENT} - 1.
* </ul>
* @apiNote
* This method is analogous to the logB operation defined in IEEE
* 754, but returns a different value on subnormal arguments.
*
* @param f a {@code float} value
* @return the unbiased exponent of the argument
* @since 1.6
@ -2763,8 +2806,12 @@ public final class Math {
* <li>If the argument is NaN or infinite, then the result is
* {@link Double#MAX_EXPONENT} + 1.
* <li>If the argument is zero or subnormal, then the result is
* {@link Double#MIN_EXPONENT} -1.
* {@link Double#MIN_EXPONENT} - 1.
* </ul>
* @apiNote
* This method is analogous to the logB operation defined in IEEE
* 754, but returns a different value on subnormal arguments.
*
* @param d a {@code double} value
* @return the unbiased exponent of the argument
* @since 1.6
@ -2968,6 +3015,9 @@ public final class Math {
*
* </ul>
*
* @apiNote This method corresponds to the nextUp
* operation defined in IEEE 754.
*
* @param d starting floating-point value
* @return The adjacent floating-point value closer to positive
* infinity.
@ -3004,6 +3054,9 @@ public final class Math {
*
* </ul>
*
* @apiNote This method corresponds to the nextUp
* operation defined in IEEE 754.
*
* @param f starting floating-point value
* @return The adjacent floating-point value closer to positive
* infinity.
@ -3040,6 +3093,9 @@ public final class Math {
*
* </ul>
*
* @apiNote This method corresponds to the nextDown
* operation defined in IEEE 754.
*
* @param d starting floating-point value
* @return The adjacent floating-point value closer to negative
* infinity.
@ -3077,6 +3133,9 @@ public final class Math {
*
* </ul>
*
* @apiNote This method corresponds to the nextDown
* operation defined in IEEE 754.
*
* @param f starting floating-point value
* @return The adjacent floating-point value closer to negative
* infinity.
@ -3116,6 +3175,9 @@ public final class Math {
* sign is returned.
* </ul>
*
* @apiNote This method corresponds to the scaleB operation
* defined in IEEE 754.
*
* @param d number to be scaled by a power of two.
* @param scaleFactor power of 2 used to scale {@code d}
* @return {@code d} &times; 2<sup>{@code scaleFactor}</sup>
@ -3200,6 +3262,9 @@ public final class Math {
* sign is returned.
* </ul>
*
* @apiNote This method corresponds to the scaleB operation
* defined in IEEE 754.
*
* @param f number to be scaled by a power of two.
* @param scaleFactor power of 2 used to scale {@code f}
* @return {@code f} &times; 2<sup>{@code scaleFactor}</sup>