< prev index next >
src/java.base/share/classes/java/lang/Math.java
Print this page
rev 54087 : 8251525: AARCH64: Faster Math.signum(fp)
Reviewed-by: aph, vlivanov, adinn
*** 1888,1897 ****
--- 1888,1898 ----
* @param d the floating-point value whose signum is to be returned
* @return the signum function of the argument
* @author Joseph D. Darcy
* @since 1.5
*/
+ @HotSpotIntrinsicCandidate
public static double signum(double d) {
return (d == 0.0 || Double.isNaN(d))?d:copySign(1.0, d);
}
/**
*** 1909,1918 ****
--- 1910,1920 ----
* @param f the floating-point value whose signum is to be returned
* @return the signum function of the argument
* @author Joseph D. Darcy
* @since 1.5
*/
+ @HotSpotIntrinsicCandidate
public static float signum(float f) {
return (f == 0.0f || Float.isNaN(f))?f:copySign(1.0f, f);
}
/**
*** 2129,2138 ****
--- 2131,2141 ----
* @param sign the parameter providing the sign of the result
* @return a value with the magnitude of {@code magnitude}
* and the sign of {@code sign}.
* @since 1.6
*/
+ @HotSpotIntrinsicCandidate
public static double copySign(double magnitude, double sign) {
return Double.longBitsToDouble((Double.doubleToRawLongBits(sign) &
(DoubleConsts.SIGN_BIT_MASK)) |
(Double.doubleToRawLongBits(magnitude) &
(DoubleConsts.EXP_BIT_MASK |
*** 2152,2161 ****
--- 2155,2165 ----
* @param sign the parameter providing the sign of the result
* @return a value with the magnitude of {@code magnitude}
* and the sign of {@code sign}.
* @since 1.6
*/
+ @HotSpotIntrinsicCandidate
public static float copySign(float magnitude, float sign) {
return Float.intBitsToFloat((Float.floatToRawIntBits(sign) &
(FloatConsts.SIGN_BIT_MASK)) |
(Float.floatToRawIntBits(magnitude) &
(FloatConsts.EXP_BIT_MASK |
< prev index next >