You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2011/01/24 14:20:29 UTC

svn commit: r1062765 - /commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java

Author: sebb
Date: Mon Jan 24 13:20:28 2011
New Revision: 1062765

URL: http://svn.apache.org/viewvc?rev=1062765&view=rev
Log:
MATH-477 FastMath Javadoc should show which methods actually use java.lang.Math internally
Also fixed round(int) to use local FastMath method

Modified:
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java?rev=1062765&r1=1062764&r2=1062765&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java Mon Jan 24 13:20:28 2011
@@ -269,6 +269,7 @@ public class FastMath {
     }
 
     /** Compute the square root of a number.
+     * <p><b>Note:</b> 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.
+     * <p><b>Note:</b> 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 {
      * <li>If the dividend is finite and the divisor is an infinity, the result equals the dividend.</li>
      * <li>If the dividend is a zero and the divisor is finite, the result equals the dividend.</li>
      * </ul>
+     * <p><b>Note:</b> 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