summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-10-01 13:44:20 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-10-01 13:44:20 +0000
commite1924d3bd4834610b8c2761b62c5f52c81fb984c (patch)
treeb6d6f5573e1e9950636754a5851b2ee15c17958d
parent1e5272f459eaeace3e2391e6739b65b8d1c7855a (diff)
downloadmpc-e1924d3bd4834610b8c2761b62c5f52c81fb984c.tar.gz
log10.c: special code for potentially exact real part needs to be carried
out in later loop if loop did not succeed before due to problem in imaginary part git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1281 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r--src/log10.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/log10.c b/src/log10.c
index a262c72..d1dbbdf 100644
--- a/src/log10.c
+++ b/src/log10.c
@@ -25,7 +25,8 @@ along with this program. If not, see http://www.gnu.org/licenses/ .
int
mpc_log10 (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
{
- int ok = 0, loops = 0, special_re, special_im, inex, inex_re, inex_im;
+ int ok = 0, loops = 0, check_exact = 0, special_re, special_im,
+ inex, inex_re, inex_im;
mpfr_t w;
mpfr_prec_t prec;
mpc_t ww;
@@ -89,11 +90,12 @@ mpc_log10 (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
thus u^2+v^2 = 0 mod 2^(2e). By recurrence on e, necessarily
u = v = 0 mod 2^e, thus x and y are necessarily integers.
*/
- if (!ok && (loops == 1) && mpfr_integer_p (mpc_realref (op)) &&
+ if (!ok && !check_exact && mpfr_integer_p (mpc_realref (op)) &&
mpfr_integer_p (mpc_imagref (op))) {
mpz_t x, y;
unsigned long s, v;
+ check_exact = 1;
mpz_init (x);
mpz_init (y);
mpfr_get_z (x, mpc_realref (op), MPFR_RNDN); /* exact */