diff --git a/src/main/java/org/apache/commons/math/util/FastMath.java b/src/main/java/org/apache/commons/math/util/FastMath.java
index cf3650677..2be206df9 100644
--- a/src/main/java/org/apache/commons/math/util/FastMath.java
+++ b/src/main/java/org/apache/commons/math/util/FastMath.java
@@ -18,6 +18,17 @@ package org.apache.commons.math.util;
/**
* Faster, more accurate, portable alternative to StrictMath.
+ *
+ * Additionally implements the following methods:
+ *
+ * - {@link #asinh(double)}
+ * - {@link #acosh(double)}
+ * - {@link #atanh(double)}
+ * - {@link #nextAfter(float,float)}
+ * - {@link #nextAfter(double,double)}
+ * - {@link #nextUp(double)}
+ * - {@link #nextUp(float)}
+ *
* @version $Revision$ $Date$
* @since 2.2
*/
@@ -161,7 +172,7 @@ public class FastMath {
1.2599210498948732,
1.5874010519681994 };
- /**
+ /**
* 0x40000000 - used to split a double into two parts, both with the low order bits cleared.
*/
private static final double HEX_40000000 = 1073741824.0;
@@ -3150,7 +3161,7 @@ public class FastMath {
}
if (abs(r) < Double.MAX_VALUE/HEX_40000000){ // is it safe to split r ?
- temp = r * HEX_40000000;
+ temp = r * HEX_40000000;
} else {
temp = 0.0;
}
@@ -3654,4 +3665,44 @@ public class FastMath {
return (a <= b) ? b : (Double.isNaN(a + b) ? Double.NaN : a);
}
+ /**
+ * Returns the hypotenuse of a triangle with sides {@code x} and {@code y}
+ * - sqrt(x2 +y2)
+ * avoiding intermediate overflow or underflow.
+ *
+ *
+ * - If either argument is infinite, then the result is positive infinity.
+ * - else, if either argument is NaN then the result is NaN.
+ *
+ *
+ * @param x a value
+ * @param y a value
+ * @return sqrt(x2 +y2)
+ */
+ public static double hypot(double x, double y) {
+ return StrictMath.hypot(x, y); // TODO provide our own implementation
+ }
+ /**
+ * Computes the remainder as prescribed by the IEEE 754 standard.
+ * The remainder value is mathematically equal to {@code x - y*n}
+ * where {@code n} is the mathematical integer closest to the exact mathematical value
+ * of the quotient {@code x/y}.
+ * If two mathematical integers are equally close to {@code x/y} then
+ * {@code n} is the integer that is even.
+ *
+ *
+ * - If either operand is NaN, the result is NaN.
+ * - If the result is not NaN, the sign of the result equals the sign of the dividend.
+ * - If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
+ * - If the dividend is finite and the divisor is an infinity, the result equals the dividend.
+ * - If the dividend is a zero and the divisor is finite, the result equals the dividend.
+ *
+ * @param dividend the number to be divided
+ * @param divisor the number by which to divide
+ * @return the remainder, rounded
+ */
+ public static double IEEEremainder(double dividend, double divisor) {
+ return StrictMath.IEEEremainder(dividend, divisor); // TODO provide our own implementation
+ }
+
}