summaryrefslogtreecommitdiff
path: root/mpz/tdiv_r_ui.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>1996-08-27 06:55:40 +0200
committertege <tege@gmplib.org>1996-08-27 06:55:40 +0200
commit1bcc22a2f37efcfd8bb1d25ae0d028acd61f3ce2 (patch)
treecb59de1cdbee985210172f7d3484bbc4dd6e028a /mpz/tdiv_r_ui.c
parenta4f5438c0e49f1a2d151f34a42c99f9e93400e90 (diff)
downloadgmp-1bcc22a2f37efcfd8bb1d25ae0d028acd61f3ce2.tar.gz
Special case for division by 0.
Diffstat (limited to 'mpz/tdiv_r_ui.c')
-rw-r--r--mpz/tdiv_r_ui.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/mpz/tdiv_r_ui.c b/mpz/tdiv_r_ui.c
index 0428b52c3..d93748ae7 100644
--- a/mpz/tdiv_r_ui.c
+++ b/mpz/tdiv_r_ui.c
@@ -37,15 +37,12 @@ mpz_tdiv_r_ui (rem, dividend, divisor)
mp_size_t size;
mp_limb_t remainder_limb;
+ if (divisor == 0)
+ DIVIDE_BY_ZERO;
+
dividend_size = dividend->_mp_size;
size = ABS (dividend_size);
- if (size == 0)
- {
- rem->_mp_size = 0;
- return;
- }
-
/* No need for temporary allocation and copying if QUOT == DIVIDEND as
the divisor is just one limb, and thus no intermediate remainders
need to be stored. */