summaryrefslogtreecommitdiff
path: root/src/mulders.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2010-09-27 08:17:11 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2010-09-27 08:17:11 +0000
commit7275c9bcad54703dd247127d5f25c234ce424892 (patch)
tree38dbefa7b1f36082f70a02aed56c680259eba775 /src/mulders.c
parent7e2cc060cfc6ca107e3d03b90a1f690cdf77adf2 (diff)
downloadmpfr-7275c9bcad54703dd247127d5f25c234ce424892.tar.gz
[mulders.c] modified mpfr_sqrhigh_n threshold so that it is > n/2
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7173 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/mulders.c')
-rw-r--r--src/mulders.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mulders.c b/src/mulders.c
index ef9ba759f..fe6635599 100644
--- a/src/mulders.c
+++ b/src/mulders.c
@@ -55,7 +55,7 @@ mpfr_mulhigh_n (mp_ptr rp, mp_srcptr np, mp_srcptr mp, mp_size_t n)
{
mp_size_t k;
- MPFR_ASSERTD (MPFR_MULHIGH_TAB_SIZE > 4);
+ MPFR_ASSERTD (MPFR_MULHIGH_TAB_SIZE >= 8); /* so that 3*(n/4) > n/2 */
k = MPFR_LIKELY (n < MPFR_MULHIGH_TAB_SIZE) ? mulhigh_ktab[n] : 3*(n/4);
MPFR_ASSERTD (k == -1 || k == 0 || (k > n/2 && k < n));
if (k < 0)
@@ -90,8 +90,9 @@ mpfr_sqrhigh_n (mp_ptr rp, mp_srcptr np, mp_size_t n)
{
mp_size_t k;
- MPFR_ASSERTD (MPFR_SQRHIGH_TAB_SIZE > 4);
- k = MPFR_LIKELY (n < MPFR_SQRHIGH_TAB_SIZE) ? sqrhigh_ktab[n] : n/2 + n/50;
+ MPFR_ASSERTD (MPFR_SQRHIGH_TAB_SIZE > 2); /* ensures k < n */
+ k = MPFR_LIKELY (n < MPFR_SQRHIGH_TAB_SIZE) ? sqrhigh_ktab[n]
+ : n/2 + n/50 + 1; /* +1 ensures that k > n/2 */
MPFR_ASSERTD (k == -1 || k == 0 || (k > n/2 && k < n));
if (k < 0)
/* we can't use mpn_sqr_basecase here, since it requires