OSDN Git Service

* java/math/BigInteger.java(signum): Handle zero properly.
authorwarrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Mar 2000 04:35:30 +0000 (04:35 +0000)
committerwarrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Mar 2000 04:35:30 +0000 (04:35 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32441 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 403a85e..2049e01 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 55e3050..69e7f68 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)