MPFR version 2.2.0 (released on 20 September 2005)

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

MPFR 2.2.0 requires GMP 4.1.0 or higher.


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

Note that the patches below have not been applied. You are strongly advised to apply the cumulative patch after extracting the MPFR archive.

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



The bugs listed below have been fixed (latest update: 2006-08-28). The following instructions are for Linux and may be similar for other operating systems. You can apply the patches in several ways:

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:

  1. The computation of lngamma(2) yields an infinite loop or an assertion failure (this special case is not tested). This bug is fixed by the lngamma(2) patch (with testcase).
  2. With gcc, the function mpfr_set_ui is also implemented by a macro, and when the second argument is the constant 0, the first argument is evaluated twice and the third argument is not evaluated at all; this may lead to a visible bug when the first and/or third arguments have side effects. The mpfr_set_si macro is also affected as it uses the mpfr_set_ui macro when the integer is the constant 0. This problem is fixed by the mpfr_set_ui macro patch (with testcase).
  3. At the time of the MPFR 2.2.0 release, there was a bug in the libtool used to generate the MPFR configure script, preventing the creation of shared libraries on Darwin (Mac OS X). This script can be fixed by the configure patch (thanks to Dave Morrison for this very simple patch); alternatively, you may want to run autoreconf if you have the necessary tools.
  4. One of the tests uses the fabs function, but -lm is not given when the executable is generated; this makes the linking fail under HP-UX. This problem is fixed by the tpow.c patch (the fabs function is no longer used).
  5. Several problems fixed by patch 5: A bit more information about this patch is available in revision 3949 data on InriaForge.
  6. The mpfr_div function where the divisor has a much smaller precision than the dividend is very slow and takes much more memory than necessary: the full-size division is performed, instead of a division of linear complexity (assuming the divisor has a bounded size). This is fixed by the small-divisor patch. Note that this efficiency bug was introduced after the rewrite of the division code for this version of MPFR, so that previous MPFR versions are not affected by this problem.
  7. The mpfr_sin function fails to round correctly on some worst cases when rounding away from zero (on the tested worst cases: GMP_RNDU rounding mode for positive numbers between 0 and π). This bug, found on 2005-12-08, was introduced on 2005-01-29 in revision 3248, therefore MPFR versions previous to 2.2.0 are not affected. For MPFR 2.2.0, this bug is fixed by the sin.c patch.
  8. The mpfr_get_f and mpfr_set_f functions are incorrect on the following cases: mpfr_get_f gives a wrong value when the result has a negative exponent and mpfr_set_f does not support overflows. These bugs are fixed by the mpfr_get_f/mpfr_set_f patch (which also potentially fixes other type problems and provides testcases).
  9. The mpfr_random2 function does not change the sign of the destination number when the size is 0; therefore it can return either -0 or +0, instead of +0 all the time. This bug is fixed by the mpfr_random2 patch (with testcase).
  10. MPFR cannot be compiled with some compilers due to empty macro arguments (allowed as of C99 only). This problem is fixed by the macro argument patch.
  11. The division has a potential bug: the code is incorrect, but we do not know if there are values that can yield an incorrect result (this is not obvious and we have not tried to search for such values yet). This is fixed by the division patch. This patch also removes symbols that were stealing GMP's namespace and all code related to mpn_sub_nc (that led to build errors in some cases, when a new version of GMP was installed, but MPFR was not recompiled).
  12. The mpfr_get_f function has another bug, not fixed by the mpfr_get_f/mpfr_set_f patch. This one is fixed by the mpfr_get_f patch (with testcase).
  13. If -I/-L options are given to CPPFLAGS/LDFLAGS and the --with-gmp configure option (or a similar one) is used, then directories may be added in an inconsistent order to CPPFLAGS and LDFLAGS at configure time. If several GMP versions are installed, then this bug can lead to compilation or linking errors (such as undefined reference to __gmp_get_memory_functions), or perhaps runtime errors (such as incorrect results). This bug is fixed by the --with-gmp patch.

    Note that even with this patch, you may still get a warning saying that gmp.h and libgmp seem to have different versions or you cannot run a program linked with GMP. The test is currently not reliable enough in practice and the warning may be confusing. The MPFR library should still be built correctly, though. Also, you may want to read this new version of the INSTALL file, as some information about such paths has been added.

  14. Darwin (Mac OS X) users should apply the -search_paths_first patch. It fixes a problem with Apple's linker when several GMP versions are installed and for one of them, only the static library is installed.
  15. Patch 15 fixes the following bugs and adds some testcases.
  16. With the previous patch, the texp2 test fails on 64-bit machines. This problem is fixed by the texp2 patch (apply the previous patch first if you haven't done this yet). Note: this is a bug in the tests, not in the library itself (and some old test code has been fixed here, not just code introduced by the previous patch).

You can also download the new mpfr-longlong.h file from the 2.2 branch. In particular, it is needed with GMP 4.2.1 under HP-UX to avoid unsatisfied symbols errors about __gmpn_umul_ppmm.

The following bugs are fixed in MPFR 2.2.1:

In addition to the bugs mentioned in the BUGS file:

Changes from versions 2.1.* to version 2.2.0

Platforms Known to Support MPFR

MPFR 2.2.0 has been successfully compiled and checked (with --enable-assert=full, in general) on the following platforms:

Back to the MPFR page.