GNU MPFR version 4.0.2 (released on 31 January 2019)

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

The dinde aux marrons release, patch level 2.

MPFR 4.0.2 requires GMP 5.0 or higher.

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 4.0.2 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 980C197698C3739D; this key can be retrieved with:

gpg --recv-keys 980C197698C3739D

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: 2020-06-02). 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 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 build of MPFR can fail if volatile is a macro. This bug is fixed by the include-float patch.
    Corresponding changeset in the 4.0 branch: ae2b7026 (r13499).
  2. Due to a bad choice of integer types, some integer additions are done in unsigned arithmetic and the result is then converted to a signed integer type; when the result is meant to be negative, this is not portable and may yield a crash. The mpfr_agm function is potentially affected by an integer overflow in huge precisions. These bugs are fixed by the int-overflow patch.
    Corresponding changeset in the 4.0 branch: a7e2de37 (r13828).
  3. Underflow detection in the mpfr_set_uj_2exp function is incorrect: it is done before rounding instead of after rounding; this affects the mpfr_set_sj_2exp function too (and theoretically the mpfr_set_uj and mpfr_set_sj functions in an extremely reduced exponent range). The mpfr_set_ui_2exp, mpfr_set_si_2exp, mpfr_set_uj_2exp and mpfr_set_sj_2exp functions behave incorrectly with very large exponent arguments. These bugs are fixed by the set-int patch, which also provides testcases.
    Corresponding changesets in the 4.0 branch: 7bc18704 (r13836), 5bf05081 (r13838).
  4. In the internal mpfr_sub1 function (from sub1.c), which is the function that does a real subtraction, there are issues with UBF support, used by the mpfr_fmma and mpfr_fmms functions, and also by the mpfr_fma and mpfr_fms functions in some overflow/underflow cases: underflow detection is incorrect (in particular, a number with an out-of-range exponent can be returned) and MPFR_RNDF is broken in some cases. These bugs are fixed by the sub1-ubf patch, which also provides testcases. Note: without patch 3, the tests will fail.
    Corresponding changesets in the 4.0 branch: 2daf4b21 (r13697), b1a7761d (r13837), ee0b2a83 (r13841).
  5. A const qualifier is sometimes missing in the configure script and in test files, which makes their compilation fail with -Wwrite-strings -Werror (as used in internal testing). This is fixed by the const patch.
    Corresponding changesets in the 4.0 branch: 918b175c (r13516), 7df2d7b9 (r13520).
  6. When MPFR is built with -DMPFR_GROUP_STATIC_SIZE=0 (mainly for testing), a zero-length array is used, which is a GNU extension. This is avoided by the array-length patch, which uses a flexible array member instead (this has been introduced in ISO C99).
    Corresponding changeset in the 4.0 branch: cfc87551 (r13518).
  7. A test introduced by patch 4 is incorrect and may fail with some seeds, such as GMP_CHECK_RANDOMIZE=1585822440108893. This is fixed by the sub1-ubftest patch.
    Corresponding changeset in the 4.0 branch: f6bf0d06 (r13869).
  8. The computation of Bernoulli numbers is wrong when the initial precision is not large enough, so that a second iteration in the Ziv loop is needed (but done incorrectly). This can occur only for large Bernoulli numbers and can affect mpfr_gamma in particular. This bug, introduced in MPFR 4.0.0, is fixed by the bernoulli-ziv patch, which also provides a testcase (enabled only when the environment variables MPFR_CHECK_EXPENSIVE and MPFR_CHECK_LARGEMEM are set, as it takes much more time than the usual tests and needs much memory).
    Corresponding changesets in the 4.0 branch: 0248dc13 (r13924).
  9. The MPFR compilation fails when the -fanalyzer option of GCC 10 and later is used (for code testing and debugging). This is due to incorrect code in src/fpif.c; this code is actually never run, unless the user provides an invalid realloc function to GMP's mp_set_memory_functions function (when a reallocation fails, the expected behavior of the allocator is to abort, not to return a null pointer). This minor issue is fixed by the fpif-dead-code patch.
    Corresponding changesets in the 4.0 branch: 593c4da3 (r13900).

The output functions have the following minor issues. In mpfr_out_str, when the exponent of the converted value is 0, it is not output, contrary to what is described in the MPFR manual (short discussion in the mpfr list); note that this does not change the value of the printed string, so that this has no effect on applications that just re-read the value (with MPFR or another code). The MPFR formatted output functions (mpfr_printf, etc.) called with an empty precision field do not output trailing zeros in some cases where these trailing zeros are required with the formatted output functions from C. In particular, concerning the conversion specifier e / E: up to 4.0.x, the chosen precision is not fully specified and depends on the input value, which can be misleading; as of 4.1.0, the precision is fully specified and no longer depends on the input value. These issues have been fixed for the future MPFR 4.1.0 version, and here are the corresponding patches:

See also the tracker and the BUGS file.

Changes from version 4.0.1 to version 4.0.2

Platforms Known to Support MPFR

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

Back to the MPFR page.