diff options
author | Torbjorn Granlund <tege@gmplib.org> | 2011-05-05 22:49:27 +0200 |
---|---|---|
committer | Torbjorn Granlund <tege@gmplib.org> | 2011-05-05 22:49:27 +0200 |
commit | be4d6e7e326a372fd8551b4ec38b38231830cafd (patch) | |
tree | 0a89ae4f6fc4a109c66e10a7cd0fe2c986451c5d /mpz/gcdext.c | |
parent | 8f54013d5ba5c6744dacdc180a857d7b81d8f384 (diff) | |
download | gmp-be4d6e7e326a372fd8551b4ec38b38231830cafd.tar.gz |
Correct sgn computation.
Diffstat (limited to 'mpz/gcdext.c')
-rw-r--r-- | mpz/gcdext.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mpz/gcdext.c b/mpz/gcdext.c index e74e318bc..47c992634 100644 --- a/mpz/gcdext.c +++ b/mpz/gcdext.c @@ -50,10 +50,10 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b) MPZ_PTR_SWAP (s, t); } - if (bsize == 0) + if (bsize == 0) { - /* g = |a|, s = sign(a), t = 0. */ - ssize = SIZ (a) >= 0 ? 1 : -1; + /* g = |a|, s = sgn(a), t = 0. */ + ssize = SIZ (a) >= 0 ? (asize != 0) : -1; if (ALLOC (g) < asize) _mpz_realloc (g, asize); @@ -77,7 +77,7 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b) tmp_bp = TMP_ALLOC_LIMBS (bsize); MPN_COPY (tmp_ap, ap, asize); MPN_COPY (tmp_bp, bp, bsize); - + tmp_gp = TMP_ALLOC_LIMBS (bsize); tmp_sp = TMP_ALLOC_LIMBS (bsize); |