BigInteger.java (euclidInv): Make sure quot and rem are in canonical form after divide().
2002-12-18 Raif Naffah <raif@fl.net.au> * java/math/BigInteger.java (euclidInv): Make sure quot and rem are in canonical form after divide(). (modInverse): Likewise. From-SVN: r60292
This commit is contained in:
parent
71d082af2f
commit
a17cf75b73
@ -1,3 +1,9 @@
|
||||
2002-12-18 Raif Naffah <raif@fl.net.au>
|
||||
|
||||
* java/math/BigInteger.java (euclidInv): Make sure quot and rem are in
|
||||
canonical form after divide().
|
||||
(modInverse): Likewise.
|
||||
|
||||
2002-12-13 Casey Marshall <rsdio@metastatic.org>
|
||||
Mark Wielaard <mark@klomp.org>
|
||||
|
||||
|
@ -1113,6 +1113,9 @@ public class BigInteger extends Number implements Comparable
|
||||
BigInteger rem = new BigInteger();
|
||||
BigInteger quot = new BigInteger();
|
||||
divide(a, b, quot, rem, FLOOR);
|
||||
// quot and rem may not be in canonical form. ensure
|
||||
rem.canonicalize();
|
||||
quot.canonicalize();
|
||||
xy = euclidInv(b, rem, quot);
|
||||
}
|
||||
|
||||
@ -1192,6 +1195,9 @@ public class BigInteger extends Number implements Comparable
|
||||
BigInteger rem = new BigInteger();
|
||||
BigInteger quot = new BigInteger();
|
||||
divide(x, y, quot, rem, FLOOR);
|
||||
// quot and rem may not be in canonical form. ensure
|
||||
rem.canonicalize();
|
||||
quot.canonicalize();
|
||||
result = euclidInv(y, rem, quot)[swapped ? 0 : 1];
|
||||
|
||||
// Result can't be negative, so make it positive by adding the
|
||||
|
Loading…
Reference in New Issue
Block a user