summaryrefslogtreecommitdiff
path: root/src/sqrt.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2010-09-29 13:15:33 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2010-09-29 13:15:33 +0000
commit9cfe7f7883710e842da212956360ecd79ecc40a6 (patch)
tree88f0421499c911d4d6d0e6a136de9e46907b8cf3 /src/sqrt.c
parent97ef5a0b63e9b160a0966940f54628ffcf6d0989 (diff)
downloadmpfr-9cfe7f7883710e842da212956360ecd79ecc40a6.tar.gz
added new option --enable-gmp-internals to use GMP undocumented function
(at user's own risk). So far only mpn_rootrem is used in mpfr_sqrt. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7182 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/sqrt.c')
-rw-r--r--src/sqrt.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/sqrt.c b/src/sqrt.c
index d2b526219..8641e522e 100644
--- a/src/sqrt.c
+++ b/src/sqrt.c
@@ -133,13 +133,11 @@ mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
/* sticky0 is non-zero iff the truncated part of the input is non-zero */
/* mpn_rootrem with NULL 2nd argument is faster than mpn_sqrtrem, thus use
- it if available. Note: since __gmpn_rootrem is not in the GMP API (at
- least for GMP 5.0.1), we should not use it for releases of MPFR, since
- it might be removed or changed in future versions of GMP. */
-#ifdef HAVE___GMPN_ROOTREM
+ it if available and if the user asked to use GMP internal functions */
+#if defined(WANT_GMP_INTERNALS) && defined(HAVE___GMPN_ROOTREM)
tsize = __gmpn_rootrem (rp, NULL, sp, rrsize, 2);
#else
- tsize = mpn_sqrtrem (rp, tp = sp, sp, rrsize);
+ tsize = mpn_sqrtrem (rp, NULL, sp, rrsize);
#endif
/* a return value of zero in mpn_sqrtrem indicates a perfect square */
@@ -163,7 +161,7 @@ mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
{
/* if sh < GMP_NUMB_BITS, the round bit is bit (sh-1) of sticky1
and the sticky bit is formed by the low sh-1 bits from
- sticky1, together with {tp, tsize} and sticky0. */
+ sticky1, together with the sqrtrem remainder and sticky0. */
if (sh < GMP_NUMB_BITS)
{
if (sticky1 & (MPFR_LIMB_ONE << (sh - 1)))