GNU MPFR version 3.1.0 (released on 3 October 2011)

[download] [documentation] [bugs] [changes] [platforms] [timings]

The canard à l'orange release.

MPFR 3.1.0 requires GMP 4.1.0 or higher (GMP 4.2.3 or higher is recommended).

Note: the bug-fix release MPFR 3.1.1 is available. Please upgrade!

Warning! Due to the fact that TLS support is now detected automatically, the MPFR build can be incorrect on some platforms (compiler or system bug). Indeed, the TLS implementation of some compilers/platforms is buggy, and MPFR cannot detect every problem at configure time. Please run make check to see if your build is affected. If you get failures, you should try the --disable-thread-safe configure option to disable TLS and see if this solves these failures. But you should not use an MPFR library with TLS disabled in a multithreaded program (unless you know what you are doing).

Download

The MPFR 3.1.0 source can be downloaded in the following archive formats:

MPFR is also available via third-party packages and ports.

Documentation

Bugs

The bugs listed below have been fixed (latest update: 2012-05-07). The patches are distributed under the same license as this version of MPFR, that is, the GNU Lesser General Public License (GNU Lesser GPL), version 3 or later.

The following instructions are for Linux and may be similar for other operating systems. You can apply the patches in several ways:

With the first two ways, the PATCHES file is modified, so that one can know what patches have been applied, using the new mpfr_get_patches function. Moreover a suffix is added to the version string, but note that for practical reasons, not all the files where the version appears are patched; thus one can also track applied patches with the MPFR_VERSION_STRING macro (header) and the mpfr_get_version function (library). However, if some patches are not applied or if patches are applied in a different order, then the patch command will fail to update some chunks, so that the suffix is not always reliable for patches.

Note: These patches are in unified diff format and some vendors' patch commands cannot deal with them; in this case, please use GNU patch (it may already be installed on your system, e.g. as /usr/local/bin/patch or gpatch).

Fixed bugs, with patches:

  1. The MPFR_UNLIKELY internal macro definition for GCC is incorrect. The compiled code can be affected when a limb is larger than a long (e.g. with some ABI's, such as mode32 on PowerPC). The MPFR_UNLIKELY definition has been incorrect since it was introduced in MPFR 2.1.0, but problems started to be visible only in MPFR 3.1.0 with all assertions checked (the MPFR code is normally written to work with the incorrect definition). This bug is fixed by the mpfr_unlikely patch.
  2. On some platforms, such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR library is already installed in the corresponding lib directory, the tests are linked against this old MPFR library instead of the one that has just been compiled. This problem due to autoconf/automake is fixed by the lib-search-path patch.
  3. The formatted output functions (mpfr_*printf) may output/return an incorrect string when the value is rounded up to the next power of 10 (for instance, 999.99999... printed with "%.20RNg" may give "100" instead of "1000"). This bug, which has always been present (since these functions were introduced in MPFR 2.4.0), is fixed by the vasprintf patch (which also provides testcases). Note: MPFR 3.1.0 also introduced a regression in some other cases, such as -9.996 in 32 bits printed with "%.2Rg".
  4. The testsuite (make check) fails when MPFR is built against GMP 4.1.* (which is a very old version). This is not a bug in the MPFR library, but in the tests, which do not take into account the fact that the default random number generator of GMP changed between versions 4.1 and 4.2. This problem is fixed by the gmp41compat patch, which also updates the MPFR manual to mention this change (in the API Compatibility chapter).
  5. When logging is used (note that logging support must have explicitly been enabled in the MPFR build), e.g. with MPFR_LOG_ALL=1, the program may randomly freeze (observed with dynamic linking), take a lot of memory or have other random behavior. The problem actually occurs in the following functions: mpfr_add_d, mpfr_add_ui and mpfr_mul_d; but mpfr_add_ui is used by other functions (directly or indirectly). This is due to a typo in an argument for the internal logging macro MPFR_LOG_FUNC: instead of the variable mpfr_log_prec (whose value is 6 by default), the function pointer mpfr_get_prec is used, and it has an arbitrary value. This bug (#13933) is fixed by the logging-freeze patch.
  6. In the logging system, an incorrect format is used for MPFR_LOG_VAR. If the logged variable has a huge value, the output has many digits; this can potentially take much memory and disk space. This bug is fixed by the logging-varfmt patch.
  7. Since the change of mpfr_prec_t to a signed type, it is no longer possible to use precisions close to MPFR_PREC_MAX in some cases where it used to work. This problem is fixed by the large-prec patch, which also provides a simple testcase. Note that:
  8. For users of GMP's development version (GMP's Mercurial repository) and/or the future GMP 5.1.0 version (and later): The mpfr.h header file uses the gmp.h internal __gmp_const macro, which has been removed from the GMP repository on 2012-03-04. The __gmp_const patch provides a temporary fix. More precisely, in the past, this macro was used for K&R (pre-ANSI) C compatibility, and it should nowadays be defined to const; this is what the patch does when GMP doesn't define this macro. Future major MPFR versions (3.2.0 and later) will replace __gmp_const by const, like what has been done in GMP.
  9. The underflow detection code of mpfr_gamma is buggy: some results may incorrectly be regarded as underflow. This bug is fixed by the gamma-underflow patch, which also provides a testcase. Warning! While this patch avoids incorrect results on values close to underflow, it makes another problem appear: a possible infinite loop for some underflow cases. In particular, the testsuite will freeze on 32-bit machines. You also need the following patch to avoid that.
  10. As the early overflow/underflow detection code of mpfr_gamma is not exact, the exact detection must be performed in the general computation code to avoid an endless loop. This is done by the gamma-overunderflow patch, which also provides testcases.

See the tracker and the BUGS file.

Changes from versions 3.0.* to version 3.1.0

Note: The mpfr_subnormalize implementation up to MPFR 3.0.0 did not change the flags. In particular, it did not follow the generic rule concerning the inexact flag (and no special behavior was specified). The case of the underflow flag was more a lack of specification.

Platforms Known to Support MPFR

MPFR 3.1.0 has been successfully compiled and checked on the following platforms:

Back to the MPFR page.