commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1209100 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
Date Thu, 01 Dec 2011 14:22:01 GMT
Author: erans
Date: Thu Dec  1 14:22:00 2011
New Revision: 1209100

URL: http://svn.apache.org/viewvc?rev=1209100&view=rev
Log:
MATH-690
Removed "sign" methods.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java?rev=1209100&r1=1209099&r2=1209100&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java Thu
Dec  1 14:22:00 2011
@@ -41,24 +41,6 @@ public final class MathUtils {
      */
     public static final double TWO_PI = 2 * FastMath.PI;
 
-    /** -1.0 cast as a byte. */
-    private static final byte  NB = (byte)-1;
-
-    /** -1.0 cast as a short. */
-    private static final short NS = (short)-1;
-
-    /** 1.0 cast as a byte. */
-    private static final byte  PB = (byte)1;
-
-    /** 1.0 cast as a short. */
-    private static final short PS = (short)1;
-
-    /** 0.0 cast as a byte. */
-    private static final byte  ZB = (byte)0;
-
-    /** 0.0 cast as a short. */
-    private static final short ZS = (short)0;
-
     /**
      * Private Constructor
      */
@@ -134,20 +116,6 @@ public final class MathUtils {
     }
 
     /**
-     * Returns the <a href="http://mathworld.wolfram.com/Sign.html"> sign</a>
-     * for byte value {@code x}.
-     * <p>
-     * For a byte value x, this method returns (byte)(+1) if x > 0, (byte)(0) if
-     * x = 0, and (byte)(-1) if x < 0.</p>
-     *
-     * @param x the value, a byte
-     * @return (byte)(+1), (byte)(0), or (byte)(-1), depending on the sign of x
-     */
-    public static byte sign(final byte x) {
-        return (x == ZB) ? ZB : (x > ZB) ? PB : NB;
-    }
-
-    /**
      * Returns the first argument with the sign of the second argument.
      *
      * @param magnitude Magnitude of the returned value.
@@ -234,46 +202,6 @@ public final class MathUtils {
             return -magnitude; // Flip sign.
         }
     }
-
-    /**
-     * Returns the <a href="http://mathworld.wolfram.com/Sign.html"> sign</a>
-     * for int value {@code x}.
-     * <p>
-     * For an int value x, this method returns +1 if x > 0, 0 if x = 0, and -1
-     * if x < 0.</p>
-     *
-     * @param x the value, an int
-     * @return +1, 0, or -1, depending on the sign of x
-     */
-    public static int sign(final int x) {
-        return (x == 0) ? 0 : (x > 0) ? 1 : -1;
-    }
-
-    /**
-     * Returns the <a href="http://mathworld.wolfram.com/Sign.html"> sign</a>
-     * for long value {@code x}.
-     * <p>
-     * For a long value x, this method returns +1L if x > 0, 0L if x = 0, and
-     * -1L if x < 0.</p>
-     *
-     * @param x the value, a long
-     * @return +1L, 0L, or -1L, depending on the sign of x
-     */
-    public static long sign(final long x) {
-        return (x == 0L) ? 0L : (x > 0L) ? 1L : -1L;
-    }
-
-    /**
-     * Compute the <a href="http://mathworld.wolfram.com/Sign.html">sign</a>
-     * of the argument.
-     *
-     * @param x the value, a short
-     * @return 1 if {@code x > 0}, 0 if {@code x == 0}, and -1 if {@code x < 0}.
-     */
-    public static short sign(final short x) {
-        return (x == ZS) ? ZS : (x > ZS) ? PS : NS;
-    }
-
     /**
      * Check that the argument is a real number.
      *



Mime
View raw message