summaryrefslogtreecommitdiff
path: root/src/pow.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pow.c')
-rw-r--r--src/pow.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pow.c b/src/pow.c
index 67e7d94..ec9620a 100644
--- a/src/pow.c
+++ b/src/pow.c
@@ -680,11 +680,13 @@ mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
if (mpfr_get_exp (mpc_imagref(t)) > (mpfr_exp_t) q)
q = mpfr_get_exp (mpc_imagref(t));
- /* if q >= p, we get an error of order 1 on the imaginary part of t,
- which is not enough to get the correct sign of exp(t) */
- if (q >= p)
+ /* the signs of the real/imaginary parts of exp(t) are determined by the
+ quadrant of exp(i*imag(t)), which depends on imag(t) mod (2pi).
+ We ensure that p >= q + 64 to get enough precision, but this might
+ be not enough in corner cases (FIXME). */
+ if (p < q + 64)
{
- p = p + 64;
+ p = q + 64;
goto try_again;
}