From 3e737a51f447a5f0a2d4fb18b29c9a05b2dde5dc Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Mon, 24 Jan 2011 13:20:28 +0000 Subject: [PATCH] MATH-477 FastMath Javadoc should show which methods actually use java.lang.Math internally Also fixed round(int) to use local FastMath method git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_X@1062765 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/commons/math/util/FastMath.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 9ff9ce920..5739a7c37 100644 --- a/src/main/java/org/apache/commons/math/util/FastMath.java +++ b/src/main/java/org/apache/commons/math/util/FastMath.java @@ -269,6 +269,7 @@ public class FastMath { } /** 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 */ @@ -665,6 +666,7 @@ public class FastMath { } /** 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() { @@ -3758,7 +3760,7 @@ public class FastMath { * @return closest int to x */ public static int round(final float x) { - return Math.round(x); + return (int) floor(x + 0.5f); } /** Compute the minimum of two values @@ -3961,6 +3963,7 @@ public class FastMath { *

  • 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.
  • * + *

    Note: this implementation currently delegates to {@link StrictMath#IEEEremainder} * @param dividend the number to be divided * @param divisor the number by which to divide * @return the remainder, rounded