summaryrefslogtreecommitdiff
path: root/src/free_cache.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2011-05-11 00:07:05 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2011-05-11 00:07:05 +0000
commitb2f4ee3128a900a66bfd6db3368178411e72cff3 (patch)
treee25ff73fe08b38548f0cd9a1eb0a8f0f6b2801b9 /src/free_cache.c
parentf9d8e6481e18b4d432ccd0a5097ca31e4d0ef33b (diff)
downloadmpfr-b2f4ee3128a900a66bfd6db3368178411e72cff3.tar.gz
Fixed constants pi and log(2) computation when logging is used: When
MPFR is built with logging support, these two constants are used by the logging functions (via mpfr_fprintf, then mpfr_log, for the base conversion). Since the mpfr_cache function isn't re-entrant when working on the same cache, we need to define two caches for each constant. Otherwise the constants could be incorrect; for instance, "MPFR_LOG_ALL=1 ./tconst_pi" was failing. Note: the bug was introduced with the new logging system from r7575 for MPFR 3.1.0, based on mpfr_fprintf instead of mpfr_out_str (which doesn't depend on mpfr_log). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7678 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/free_cache.c')
-rw-r--r--src/free_cache.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/free_cache.c b/src/free_cache.c
index cef52ec3e..3747e8e39 100644
--- a/src/free_cache.c
+++ b/src/free_cache.c
@@ -44,8 +44,15 @@ free_l2b (void)
void
mpfr_free_cache (void)
{
+#ifndef MPFR_USE_LOGGING
mpfr_clear_cache (__gmpfr_cache_const_pi);
mpfr_clear_cache (__gmpfr_cache_const_log2);
+#else
+ mpfr_clear_cache (__gmpfr_normal_pi);
+ mpfr_clear_cache (__gmpfr_normal_log2);
+ mpfr_clear_cache (__gmpfr_logging_pi);
+ mpfr_clear_cache (__gmpfr_logging_log2);
+#endif
mpfr_clear_cache (__gmpfr_cache_const_euler);
mpfr_clear_cache (__gmpfr_cache_const_catalan);
/* free_l2b (); */