summaryrefslogtreecommitdiff
path: root/mpq
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2001-11-04 22:16:02 +0100
committerKevin Ryde <user42@zip.com.au>2001-11-04 22:16:02 +0100
commitf1100a7ff3e69708d0c193e0104f5a8d3849593e (patch)
tree8d8c905e4ff066b29c6dd2d231bf90f156985d57 /mpq
parent21f32a65914227e4c9a875eb4a9007924d47a7fa (diff)
downloadgmp-f1100a7ff3e69708d0c193e0104f5a8d3849593e.tar.gz
* mpq/canonicalize.c: DIVIDE_BY_ZERO if denominator is zero.
It's not possible to put "n/0" into canonical form, so it seems best to raise an error.
Diffstat (limited to 'mpq')
-rw-r--r--mpq/canonicalize.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mpq/canonicalize.c b/mpq/canonicalize.c
index 7673249f0..a47cc0460 100644
--- a/mpq/canonicalize.c
+++ b/mpq/canonicalize.c
@@ -29,6 +29,9 @@ mpq_canonicalize (MP_RAT *op)
mpz_t gcd;
TMP_DECL (marker);
+ if (op->_mp_den._mp_size == 0)
+ DIVIDE_BY_ZERO;
+
TMP_MARK (marker);
/* ??? Dunno if the 1+ is needed. */