Commit d98729aa by Warren Levy Committed by Warren Levy

* java/math/BigInteger.java(signum): Handle zero properly.

From-SVN: r32441
parent 299b83b7
2000-03-08 Warren Levy <warrenl@cygnus.com>
* java/math/BigInteger.java(signum): Handle zero properly.
2000-03-07 Tom Tromey <tromey@cygnus.com> 2000-03-07 Tom Tromey <tromey@cygnus.com>
* All files: Updated copyright information. * All files: Updated copyright information.
......
...@@ -285,7 +285,9 @@ public class BigInteger extends Number implements Comparable ...@@ -285,7 +285,9 @@ public class BigInteger extends Number implements Comparable
public int signum() public int signum()
{ {
int top = words == null ? ival : words[ival-1]; 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) private static int compareTo(BigInteger x, BigInteger y)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment