summaryrefslogtreecommitdiff
path: root/const_pi.c
diff options
context:
space:
mode:
Diffstat (limited to 'const_pi.c')
-rw-r--r--const_pi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/const_pi.c b/const_pi.c
index 8f63161d0..de51efe8d 100644
--- a/const_pi.c
+++ b/const_pi.c
@@ -21,6 +21,16 @@ MA 02111-1307, USA. */
#include "mpfr-impl.h"
+/* Declare the cache */
+MPFR_DECL_INIT_CACHE(__gmpfr_cache_const_pi, mpfr_const_pi_internal);
+
+/* Set User Interface */
+#undef mpfr_const_pi
+int
+mpfr_const_pi (mpfr_ptr x, mp_rnd_t rnd_mode) {
+ return mpfr_cache (x, __gmpfr_cache_const_pi, rnd_mode);
+}
+
/* Time: mpfr_const_pi2 is this new version.
norroy% time ./pi2 1000000
mpfr_const_pi took 14110ms
@@ -35,7 +45,7 @@ MA 02111-1307, USA. */
mpfr_const_pi2 took 51780ms */
int
-(mpfr_const_pi) (mpfr_ptr x, mp_rnd_t rnd_mode)
+mpfr_const_pi_internal (mpfr_ptr x, mp_rnd_t rnd_mode)
{
mpfr_t a, A, B, D, S;
mp_prec_t px, p, cancel, k, kmax;