diff options
author | Kevin Ryde <user42@zip.com.au> | 2002-08-07 02:04:19 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2002-08-07 02:04:19 +0200 |
commit | 09d2d5480774eb78f579d7442f8eb6e00ddd6f91 (patch) | |
tree | b954bdaed660a934682a5eef78d2e5462aa19dab /mpz/remove.c | |
parent | e7c124d2020760bb692595d05406dde7143bfc7d (diff) | |
download | gmp-09d2d5480774eb78f579d7442f8eb6e00ddd6f91.tar.gz |
* mpz/remove.c: Make src==0 return 0, not do DIVIDE_BY_ZERO.
Diffstat (limited to 'mpz/remove.c')
-rw-r--r-- | mpz/remove.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mpz/remove.c b/mpz/remove.c index 6e34b2263..39b4d73a8 100644 --- a/mpz/remove.c +++ b/mpz/remove.c @@ -1,6 +1,6 @@ /* mpz_remove -- divide out a factor and return its multiplicity. -Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -30,8 +30,16 @@ mpz_remove (mpz_ptr dest, mpz_srcptr src, mpz_srcptr f) unsigned long int pwr; int p; - if (mpz_cmp_ui (f, 1) <= 0 || mpz_sgn (src) == 0) + if (mpz_cmp_ui (f, 1) <= 0) DIVIDE_BY_ZERO; + + if (SIZ (src) == 0) + { + if (src != dest) + mpz_set (dest, src); + return 0; + } + if (mpz_cmp_ui (f, 2) == 0) { unsigned long int s0; |