Open GoogleCodeExporter opened 9 years ago
forgot about negative numbers... Fixed version is:
public BigInteger gcd(BigInteger b) {
if (ZERO.equals(this))
return b;
BigInteger a = abs();
b = b.abs();
while (! ZERO.equals(b))
if (a.compareTo(b) > 0) // a > b ?
a = a.subtract(b);
else
b = b.subtract(a);
return a;
}
Original comment by hhelw...@googlemail.com
on 15 Jan 2010 at 2:13
http://code.google.com/p/gwt-java-math supports BigInteger.gcd(BigInteger)
Original comment by rich...@zschech.net
on 27 May 2010 at 2:37
Original issue reported on code.google.com by
hhelw...@googlemail.com
on 6 Jan 2010 at 9:18