diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-08-27 12:19:51 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-08-27 12:19:51 +0000 |
commit | 8e0620f2dd77c5345507f473dca2b9cc2c6979b4 (patch) | |
tree | 21f172ff2e9611d0fab9f67689ac15aa47195583 /src/const_log2.c | |
parent | 5692823a905839cf9ec6b2887fb7d01e625f8f1f (diff) | |
download | mpfr-8e0620f2dd77c5345507f473dca2b9cc2c6979b4.tar.gz |
[src/const_log2.c] avoid hard-coded values
[tests/tconst_log2.c] improve coverage
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13035 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/const_log2.c')
-rw-r--r-- | src/const_log2.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/const_log2.c b/src/const_log2.c index 21217dfe8..7719768ec 100644 --- a/src/const_log2.c +++ b/src/const_log2.c @@ -126,11 +126,7 @@ mpfr_const_log2_internal (mpfr_ptr x, mpfr_rnd_t rnd_mode) ("rnd_mode=%d", rnd_mode), ("x[%Pu]=%.*Rg inex=%d", mpfr_get_prec(x), mpfr_log_prec, x, inexact)); - if (n < 1069) - w = n + 9; /* ensures correct rounding for the four rounding modes, - together with N = w / 3 + 1 (see below). */ - else - w = n + 10; /* idem at least for prec < 300000 */ + w = n + MPFR_INT_CEIL_LOG2 (n) + 3; MPFR_TMP_MARK(marker); MPFR_GROUP_INIT_2(group, w, t, q); @@ -169,9 +165,7 @@ mpfr_const_log2_internal (mpfr_ptr x, mpfr_rnd_t rnd_mode) mpz_clear (Q[i]); } - /* for prec < 300000 and all rounding modes we checked by exhaustive - search that the rounding is correct */ - if (MPFR_LIKELY (n < 300000 || MPFR_CAN_ROUND (t, w - 2, n, rnd_mode))) + if (MPFR_CAN_ROUND (t, w - 2, n, rnd_mode)) break; MPFR_ZIV_NEXT (loop, w); |