MPFR version 2.2.1 (released on 29 November 2006)

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

MPFR 2.2.1 requires GMP 4.1.0 or higher. This is the latest version of the 2.2 branch, which is no longer supported (newly discovered bugs will probably never be fixed on this branch). Please upgrade to MPFR 2.3.0 (or higher, when new versions are released): latest MPFR release.


The MPFR 2.2.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: 2007-02-17). 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, a suffix is added to the version string, so that one can know what patches have been applied. For practical reasons, not all the files where the version appears are patched, but the updated version string is available with the MPFR_VERSION_STRING macro (header) and the mpfr_get_version function (library).

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. Though documented in the MPFR manual, the mpfr_init_set_ld macro is missing. The mpfr_init_set_ld patch adds it to the mpfr.h file.
  2. A test in tests/tget_f.c yields an integer overflow (the test fails when using gcc's -ftrapv option). This is fixed by the tests/tget_f.c patch.
  3. Some cases of overflow and underflow are not correctly handled in the mpfr_set_si_2exp and mpfr_set_ui_2exp functions (wrong flags, and even an incorrect value in case of double rounding). In corner cases (emin ≥ 4 and some other constraints), the mpfr_set_si and mpfr_set_ui may set the underflow flag though an underflow did not occur. These problems are fixed by the mpfr_set_si/ui patch.
  4. The mpfr_pow_si function does not behave correctly on some extreme cases. In particular, computing 2LONG_MIN+1 with mpfr_pow_si can yield a NaN. For some input values, integer overflows may occur, but in practice, the results are correct as long as the implementation (C compiler) guarantees two's complement wrapping. These problems are fixed by the mpfr_pow_si patch. Moreover this patch avoids a bug in Sun's compiler for Solaris/x86 (with optimizations).
  5. MPFR manual update: The default install directory for the info file has changed and this patch updates it in the manual, and it adds a new section Exceptions and the missing description of the mpfr_dim function (that was added to MPFR 2.0.1).

In addition to the bugs mentioned in the BUGS file:

Changes from version 2.2.0 to version 2.2.1

Platforms Known to Support MPFR

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

Back to the MPFR page.