diff --git a/src/java/org/apache/commons/math/util/MathUtils.java b/src/java/org/apache/commons/math/util/MathUtils.java index 043a51b44..37f8bdea2 100644 --- a/src/java/org/apache/commons/math/util/MathUtils.java +++ b/src/java/org/apache/commons/math/util/MathUtils.java @@ -474,13 +474,20 @@ public final class MathUtils { } /** - * Get the closest machine representable number - * from a number in some direction. - + * Get the next machine representable number after a number, moving + * in the direction of another number. + *
+ * If direction
is greater than or equal tod
,
+ * the smallest machine representable number strictly greater than
+ * d
is returned; otherwise the largest representable number
+ * strictly less than d
is returned.
+ *
+ * If d
is NaN or Infinite, it is returned unchanged.
+ *
* @param d base number
* @param direction (the only important thing is whether
* direction is greater or smaller than d)
- * @return
+ * @return the next machine representable number in the specified direction
*/
public static double nextAfter(double d, double direction) {