summaryrefslogtreecommitdiff
path: root/mpq/div.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2000-11-03 21:21:43 +0100
committerKevin Ryde <user42@zip.com.au>2000-11-03 21:21:43 +0100
commita04e54da50c26146f763fe1cbc4f6e8c20003eeb (patch)
tree304d71e19dc90248e5663383f78d7b2698dd59f1 /mpq/div.c
parent11bfaa89502e42ce5ed7667b6f0898262e19947c (diff)
downloadgmp-a04e54da50c26146f763fe1cbc4f6e8c20003eeb.tar.gz
* mpz/divegcd.c: New file, providing mpz_divexact_gcd.
* mpq/aors.c,canonicalize.c,div.c,mul.c: Use it.
Diffstat (limited to 'mpq/div.c')
-rw-r--r--mpq/div.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/mpq/div.c b/mpq/div.c
index 569d0534f..d192d8d2e 100644
--- a/mpq/div.c
+++ b/mpq/div.c
@@ -23,15 +23,6 @@ MA 02111-1307, USA. */
#include "gmp-impl.h"
-#define DIV_OR_SET(q,a,d) \
- do { \
- if (MPZ_EQUAL_1_P (d)) \
- mpz_set (q, a); \
- else \
- mpz_divexact (q, a, d); \
- } while (0)
-
-
void
#if __STDC__
mpq_div (mpq_ptr quot, mpq_srcptr op1, mpq_srcptr op2)
@@ -63,13 +54,13 @@ mpq_div (quot, op1, op2)
mpz_gcd (gcd1, &(op1->_mp_num), &(op2->_mp_num));
mpz_gcd (gcd2, &(op2->_mp_den), &(op1->_mp_den));
- DIV_OR_SET (tmp1, &(op1->_mp_num), gcd1);
- DIV_OR_SET (tmp2, &(op2->_mp_den), gcd2);
+ mpz_divexact_gcd (tmp1, &(op1->_mp_num), gcd1);
+ mpz_divexact_gcd (tmp2, &(op2->_mp_den), gcd2);
mpz_mul (numtmp, tmp1, tmp2);
- DIV_OR_SET (tmp1, &(op2->_mp_num), gcd1);
- DIV_OR_SET (tmp2, &(op1->_mp_den), gcd2);
+ mpz_divexact_gcd (tmp1, &(op2->_mp_num), gcd1);
+ mpz_divexact_gcd (tmp2, &(op1->_mp_den), gcd2);
mpz_mul (&(quot->_mp_den), tmp1, tmp2);