diff --git a/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/AccurateMath.java b/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/AccurateMath.java index b4af270b9..632c3b352 100644 --- a/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/AccurateMath.java +++ b/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/AccurateMath.java @@ -375,15 +375,6 @@ public final class AccurateMath { return Double.longBitsToDouble(xl); } - /** Compute the square root of a number. - *

Note: this implementation currently delegates to {@link Math#sqrt} - * @param a number on which evaluation is done - * @return square root of a - */ - public static double sqrt(final double a) { - return Math.sqrt(a); - } - /** Compute the hyperbolic cosine of a number. * @param x number on which evaluation is done * @return hyperbolic cosine of x @@ -705,7 +696,7 @@ public final class AccurateMath { * @return inverse hyperbolic cosine of a */ public static double acosh(final double a) { - return AccurateMath.log(a + AccurateMath.sqrt(a * a - 1)); + return AccurateMath.log(a + Math.sqrt(a * a - 1)); } /** Compute the inverse hyperbolic sine of a number. @@ -721,7 +712,7 @@ public final class AccurateMath { double absAsinh; if (a > 0.167) { - absAsinh = AccurateMath.log(AccurateMath.sqrt(a * a + 1) + a); + absAsinh = AccurateMath.log(Math.sqrt(a * a + 1) + a); } else { final double a2 = a * a; if (a > 0.097) { @@ -820,14 +811,6 @@ public final class AccurateMath { return nextAfter(a, Float.NEGATIVE_INFINITY); } - /** Returns a pseudo-random number between 0.0 and 1.0. - *

Note: this implementation currently delegates to {@link Math#random} - * @return a random number between 0.0 and 1.0 - */ - public static double random() { - return Math.random(); - } - /** * Exponential function. * @@ -2801,7 +2784,7 @@ public final class AccurateMath { /* Square root */ double y; - y = sqrt(za); + y = Math.sqrt(za); temp = y * HEX_40000000; ya = y + temp - temp; yb = y - ya; @@ -2876,7 +2859,7 @@ public final class AccurateMath { za = temp; /* Square root */ - double y = sqrt(za); + double y = Math.sqrt(za); temp = y * HEX_40000000; ya = y + temp - temp; yb = y - ya; @@ -3682,7 +3665,7 @@ public final class AccurateMath { final double scaledY = scalb(y, -middleExp); // compute scaled hypotenuse - final double scaledH = sqrt(scaledX * scaledX + scaledY * scaledY); + final double scaledH = Math.sqrt(scaledX * scaledX + scaledY * scaledY); // remove scaling return scalb(scaledH, middleExp); diff --git a/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/JdkMath.java b/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/JdkMath.java index 6525ed7ea..52befc53d 100644 --- a/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/JdkMath.java +++ b/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/JdkMath.java @@ -284,7 +284,7 @@ public final class JdkMath { NEXTUP_FLOAT = AccurateMath::nextUp; NEXTUP_DOUBLE = AccurateMath::nextUp; POW = AccurateMath::pow; - RANDOM = AccurateMath::random; + RANDOM = Math::random; // Not implemented. RINT = AccurateMath::rint; ROUND_DOUBLE = AccurateMath::round; ROUND_FLOAT = AccurateMath::round; @@ -292,7 +292,7 @@ public final class JdkMath { SCALB_FLOAT = AccurateMath::scalb; SIGNUM_DOUBLE = AccurateMath::signum; SIGNUM_FLOAT = AccurateMath::signum; - SQRT = AccurateMath::sqrt; + SQRT = Math::sqrt; // Not implemented. SIN = AccurateMath::sin; SINH = AccurateMath::sinh; SUBTRACTEXACT_INT = AccurateMath::subtractExact;