GNU MPFR version 3.1.3 (released on 19 June 2015)

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

The canard à l'orange release, patch level 3.

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

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

Warning! Due to the fact that Thread Local Storage (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.3 source can be downloaded in the following archive formats:

Each tarball is signed by Vincent Lefèvre. This can be verified using the DSA key ID 98C3739D; this key can be retrieved with:

gpg --recv-keys 98C3739D

or by downloading it from https://www.vinc17.net/pgp.html. The key fingerprint is:

07F3 DBBE CC1A 3960 5078  094D 980C 1976 98C3 739D

The signatures can be verified with:

gpg --verify file.asc

You should check that the key fingerprint matches.

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

Documentation

Bugs

The bugs listed below have been fixed (latest update: 2016-02-23). 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_lngamma function gives NaN instead of +Inf on −0, on negative integers and on −Inf. This is fixed by the lngamma-and-doc patch, which also fixes and improves the tests and improves the MPFR manual concerning the special values.
    Corresponding changeset in the 3.1 branch: 9605.
  2. The mpfr_mul_2si, mpfr_div_2ui and mpfr_div_2si functions do not handle a potential overflow when the integer argument is 0; such an overflow can occur only when the output has less precision than the input, and this may yield a crash or a number with an out-of-range exponent. This is fixed by the muldiv-2exp-overflow patch, which also provides testcases.
    Corresponding changeset in the 3.1 branch: 9608.
  3. The mpfr_mul_2si, mpfr_div_2ui and mpfr_div_2si functions in rounding to nearest can round in the wrong direction when the exact result is −2emin−2, i.e. the middle of 0 and the minimum negative number in absolute value. This is fixed by the muldiv-2exp-underflow patch, which also provides testcases.
    Corresponding changeset in the 3.1 branch: 9620.
  4. The mpfr_frexp function does not handle internal overflow and it can yield an assertion failure when the current exponent range does not contain 0. This is fixed by the frexp patch, which also provides testcases.
    Corresponding changeset in the 3.1 branch: 9621.
  5. With some mparam.h files, the mpfr_div function can return an incorrect result. This is fixed by the divhigh-basecase patch, which also provides a testcase. Note that this bug is new in MPFR 3.1 and cannot be triggered with the mparam.h files distributed in the tarball. Thus most users should not be affected. However this bug may be visible after a make tune (which generates a new mparam.h file). More details in the discussion in the MPFR list.
    Corresponding changeset in the 3.1 branch: 9711.
  6. The Bessel functions (mpfr_j0, mpfr_j1, mpfr_jn, mpfr_y0, mpfr_y1, mpfr_yn) can return an incorrect result. This is fixed by the jn patch, which also provides a testcase. Bug report by Fredrik Johansson.
    Corresponding changeset in the 3.1 branch: 9845.
  7. The Riemann Zeta function mpfr_zeta can return an incorrect result when the argument is near an even negative integer. This is fixed by the zeta patch, which also provides a testcase. Bug report by Fredrik Johansson.
    Corresponding changeset in the 3.1 branch: 9855.
  8. The square root function mpfr_sqrt can return invalid data under very particular conditions: when the precision of the result is a multiple of the number of bits per word (GMP_NUMB_BITS), the rounding mode is to nearest (MPFR_RNDN), and internally, the result has to be rounded up to a power of 2. This can yield assertion failures (or other unknown behavior), thus make applications crash. This is fixed by the sqrt patch, which also provides a testcase. Bug report by Fredrik Johansson.
    Corresponding changesets in the 3.1 branch: 9860, 9862.
  9. The si functions (mpfr_add_si, mpfr_sub_si, mpfr_si_sub, mpfr_mul_si, mpfr_div_si, mpfr_si_div) have undefined behavior when the integer is the minimum one: LONG_MIN. However, on most processors (if not all), this bug has no visible effect when MPFR is compiled in the usual way. It is visible when using an undefined behavior sanitizer. This is fixed by the si-ops patch.
    Corresponding changeset in the 3.1 branch: 10023. Changeset 10002 improves the generic tests of functions with an integer argument, but is not included in this patch since it is more general.
  10. The mpfr_can_round_raw internal rounding-test function can return true instead of false in case of a change of binade (more specifically, exponent decrease) on the approximation interval. This bug affects the mpfr_can_round public function. Some MPFR math functions might also be affected, but if they are, errors should be very rare. Consequences can be inaccurate results. This is fixed by the can_round patch, which also provides testcases and cleans up related code. Bug report and discussion.
    Corresponding changeset in the 3.1 branch: 10029.
  11. The mpfr_fits_* functions (mpfr_fits_ulong_p, mpfr_fits_slong_p, mpfr_fits_uint_p, etc.) can set some flags, while the flags should not be modified. These functions can also trigger assertion failures for non-integer numbers just above the positive limit of the type when additional assertions are checked (MPFR configured with --enable-assert). This is fixed by the fits patch, which also provides testcases.
    Corresponding changeset in the 3.1 branch: 10035.
  12. The mpfr_root function, which computes the kth root of a floating-point number has major issues with large values of k: MPFR can take much memory, and when k is very large, MPFR can crash or the function can return an incorrect result due to internal integer overflow. This is fixed by the root patch, which also provides testcases. This has been done by changing the algorithm for k > 100. Bug report.
    Corresponding changeset in the 3.1 branch: 10040.
  13. The mpfr_gamma function has the following issues when the argument is an integer fitting in an unsigned long: it may set the inexact flag even when the result is exact, and the result may be incorrect in a very reduced exponent range. This is fixed by the gamma patch, which also provides a testcase.
    Corresponding changeset in the 3.1 branch: 10071.
  14. When mpfr_fmod, mpfr_remainder or mpfr_remquo is called on arguments with a huge difference in magnitude, MPFR can take much memory or crash. This is fixed by the rem1 patch, which also provides testcases.
    Corresponding changeset in the 3.1 branch: 10075.
  15. When mpfr_agm is called on arguments that have the same value, the ternary value is set to 0, whether the result is exact or not. This is fixed by the agm-eq patch, which also provides a testcase.
    Corresponding changeset in the 3.1 branch: 10078.
  16. The mpfr_sum function can return wrong results when not all the numbers have the same precision. This is fixed by the sum patch, which also provides a testcase. A side effect of this fix is that it can make mpfr_sum much slower and/or take much more memory in some of such cases with the same program; this is normal and cannot easily be avoided with the current algorithm.
    The full rewrite currently in the trunk (for the next major version) has not been merged because this would not be a simple patch (and it is still incomplete when a number is reused as the output). Thus MPFR can still take much memory or crash when a huge internal precision is needed in case the exact result is very close to a number that is exactly representable in the output precision (+ 1 for rounding to nearest); this is the Table Maker's Dilemma.
    Note also that the prototype of the mpfr_sum_sort internal but exported function had to be changed. Since this function is used only internally and by the tests, this does not break the ABI. However the old (3.1.3) and new tsum tests are source & binary incompatible.
    Corresponding changeset in the 3.1 branch: 10083.
  17. The mpfr_cmp_d (resp. mpfr_cmp_ld) function was setting the NaN flag when the double (resp. long double) was a NaN and could return an incorrect result (assertion failure in debug mode) in reduced exponent range. This is fixed by the cmp_d patch, which also provides testcases.
    Corresponding changeset in the 3.1 branch: 10090.

Other bugs: please see the tracker and the BUGS file.

Changes from version 3.1.2 to version 3.1.3

Platforms Known to Support MPFR

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

Back to the MPFR page.