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/20 02:27:35 UTC

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

Author: sebb
Date: Thu Jan 20 01:27:35 2011
New Revision: 1061095

URL: http://svn.apache.org/viewvc?rev=1061095&view=rev
Log:
Javadoc clarification for signum

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=1061095&r1=1061094&r2=1061095&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 Thu Jan 20 01:27:35 2011
@@ -576,19 +576,19 @@ public class FastMath {
     /** Compute the signum of a number.
      * The signum is -1 for negative numbers, +1 for positive numbers and 0 otherwise
      * @param a number on which evaluation is done
-     * @return -1, 0, +1 or NaN depending on sign of a
+     * @return -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
      */
     public static double signum(final double a) {
-        return (a < 0.0) ? -1.0 : ((a > 0.0) ? 1.0 : a);
+        return (a < 0.0) ? -1.0 : ((a > 0.0) ? 1.0 : a); // return +0.0/-0.0/NaN depending on a
     }
 
     /** Compute the signum of a number.
      * The signum is -1 for negative numbers, +1 for positive numbers and 0 otherwise
      * @param a number on which evaluation is done
-     * @return -1, 0, +1 or NaN depending on sign of a
+     * @return -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
      */
     public static float signum(final float a) {
-        return (a < 0.0f) ? -1.0f : ((a > 0.0f) ? 1.0f : a);
+        return (a < 0.0f) ? -1.0f : ((a > 0.0f) ? 1.0f : a); // return +0.0/-0.0/NaN depending on a
     }
 
     /** Compute next number towards positive infinity.