* java/math/BigInteger.java(signum): Handle zero properly.
authorWarren Levy <warrenl@cygnus.com>
Thu, 9 Mar 2000 04:35:30 +0000 (04:35 +0000)
committerWarren Levy <warrenl@gcc.gnu.org>
Thu, 9 Mar 2000 04:35:30 +0000 (04:35 +0000)
From-SVN: r32441

libjava/ChangeLog
libjava/java/math/BigInteger.java

index 403a85ed9ed56261c14249572ac8bb7fc6e1e031..2049e0158ed3387fea8c1b06314044860aade64a 100644 (file)
@@ -1,3 +1,7 @@
+2000-03-08  Warren Levy  <warrenl@cygnus.com>
+
+       * java/math/BigInteger.java(signum): Handle zero properly.
+
 2000-03-07  Tom Tromey  <tromey@cygnus.com>
 
        * All files: Updated copyright information.
index 55e30509ab28960a125bca0754981c00666301a2..69e7f68506b64963325bd2b2fcfba70faf6820c9 100644 (file)
@@ -285,7 +285,9 @@ public class BigInteger extends Number implements Comparable
   public int signum()
   {
     int top = words == null ? ival : words[ival-1];
-    return top > 0 ? 1 : top < 0 ? -1 : 0;
+    if (top == 0 && words == null)
+      return 0;
+    return top < 0 ? -1 : 1;
   }
 
   private static int compareTo(BigInteger x, BigInteger y)