GNU MPFR version 3.0.1 (released on 4 April 2011)

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

The boudin aux pommes release, patch level 1.

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

This is the latest version of the 3.0 branch, which is no longer supported (major bugs will be fixed for some time as patches only). Please upgrade to MPFR 3.1.0 (or higher, when new versions are released): latest MPFR release.


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

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



The bugs listed below have been fixed (latest update: 2011-05-09). 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. If the exponent range has been reduced such that emax = 1 or 2, mpfr_asin may give an incorrect result on +1 and -1. This bug is fixed by the asin_exprange patch (which also provides a testcase).
  2. The mpfr_rec_sqrt function can have undefined behavior due to the call of mpn_add_1 or mpn_sub_1 (from GMP) with a null size, which is not allowed. The fourth argument of mpn_add_1 or mpn_sub_1 (i.e. the value that should have been added or subtracted) is here also 0, so that the consequences are limited. In practice, with the current GMP version, this yields a small buffer overflow (1 limb, i.e. 32 bits or 64 bits), as shown by valgrind, with the possible consequences: a crash, or memory corruption (very unlikely) if another process or thread modifies the limb at the same time (as in this context, the value is first read then written back by GMP). This bug has always been present since the introduction of the mpfr_rec_sqrt function in MPFR 2.4.0. It is fixed by the rec_sqrt-carry patch.
  3. The mpfr_atan function calls mpfr_check_range on the unrounded result (no longer allocated) instead of the rounded result. Consequence of this bug: possible incorrect or invalid result and/or incorrect flags if the unrounded result or rounded result is not in the current exponent range. Or possibly worse if the memory used by the unrounded result is modified before the return of the function. This bug has been present since MPFR 2.1.0 (exceptions were not supported before). It is fixed by the atan-expo-range patch.
  4. The texp test doesn't filter out the value 0 (which can appear with some seeds, set by GMP_CHECK_RANDOMIZE) when comparing the mpfr_exp_2 and mpfr_exp_3 internal functions. The consequence is a failure in this test if this happens. This is a bug only in the tests, not in the library itself. It is fixed by the texp-zero patch.

The following bugs are fixed in the 3.1 branch (for the future MPFR 3.1.0):

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

Microsoft Windows users who wish to build a DLL with GCC 4.6 and later should look at this thread.

Changes from version 3.0.0 to version 3.0.1

Bug fixes (detailed list on the MPFR 3.0.0 page).

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.0.1 has been successfully compiled and checked on the following platforms:

Back to the MPFR page.