MPFR 2.1.1 requires GMP 4.1.0 or higher.

MPFR 2.1.1 can be downloaded in the following archive formats:

- mpfr-2.1.1.tar.bz2 (tar/bzip2, 485 KB) (signature),
- mpfr-2.1.1.tar.gz (tar/gzip, 605 KB) (signature),
- mpfr-2.1.1.zip (zip, 857 KB) (signature).

The signatures can be checked with
Laurent Fousse's key
(or grab this key `A1696D2B` from the keyserver
`keyserver.noreply.org`).

Note that the patches below have not been applied.

MPFR is also available as the official Debian package libmpfr-dev. Patches 1 to 6 have been applied in libmpfr-dev 2.1.1-5 (Sarge version). Patches 7 and 8 have been applied in libmpfr-dev 2.1.1-7. Patches 9, 10 and 11 have been applied in libmpfr-dev 2.1.1-9, 2.1.1-10 and 2.1.1-11 respectively.

- The reference manual: [html] [dvi] [ps] [pdf]
- The reference manual translated into Japanese.

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

- Apply the cumulative patch on the 2.1.1 release
or a partially patched version with the command
patch -N -Z -p1 <

from the build directory. The`path_to_patches_file``-N`option allows the`patch`command to ignore patches already applied. The`-Z`option sets the modification time of the patched files from time stamps given in the patch file, thus avoiding the need of some development utilities (such as autoconf). - Or apply the individual patches below.
- Or checkout the CVS branch
`mpfr-2-1-branch`thanks to the option`-rmpfr-2-1-branch`. In this case, please see the MPFR CVS page for more information.

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`).

- The following patch fixes a bug in the exponential function
due to a wrong approximation to x/log(2):
`mpfr_exp_2`

patch (with testcase). - The low-level addition of the form
(
`a`,`b`,`a`) is buggy when the exponent of`b`is equal to the exponent of`a`plus the precision of`b`; the following patch fixes that:`mpfr_add1sp`

patch (with testcase). - The
`mpfr_atanh`

function returns an infinity instead of NaN for input values`x`such that 1 < |`x`| < 2. This bug is fixed by the`mpfr_atanh`

patch (with testcase). - The
`mpfr_pow_ui`

function to evaluate`x`^{n}(`n`being a nonnegative integer) has two bugs. First, if`x`= 0 and`n`> 0, the result 0 may have a wrong sign. The second bug occurs in some cases that are*difficult to round*and yields values that are not correctly rounded. These two bugs are fixed by the`mpfr_pow_ui`

patch, which also provides a testcase for the second bug. - A possible infinite loop in
`mpfr_get_ld`

with very small numbers. This bug is fixed by the`mpfr_get_ld`

patch (with testcase). - The testcase in the
`mpfr_get_ld`

patch was buggy, and there is a bug in`mpfr_set_ld`

too, still with very small numbers. This is fixed by the`mpfr_set_ld`

patch. - The
`mpfr_div_ui`

function is buggy. It is fixed in the`mpfr_div_ui`

patch (with testcase). - An infinite loop in
`mpfr_hypot`

if one of the inputs is*much*larger than the other one*and*its precision is larger than the precision of the result. The cause is an overflow in the internal computations. This bug is fixed by the`mpfr_hypot`

patch (with testcase). - A bug was indirectly introduced in the addition when the internal
format of MPFR numbers changed: overflows in the
final rounding are no longer handled correctly. This bug is fixed by
the
`mpfr_add1`

patch. - The
`mpfr_atan`

function on -0 returns +0 instead of -0. This bug is fixed by the`mpfr_atan`

patch (with testcase). - The
`mpfr_strtofr`

function may fail under some locales due to the use of the`strncasecmp`

function, as shown by the following program. This program uses the Turkish locale`tr_TR.ISO8859-9`where the ASCII charactersI

andi

do not match (you need to have this locale installed on your system if you want to test this program). This bug is fixed by the`parse_string`

patch.#include <stdio.h> #include <stdlib.h> #include <locale.h> #include <gmp.h> #include <mpfr.h> int main (void) { mpfr_t x; char *endptr; if (setlocale (LC_CTYPE, "tr_TR.ISO8859-9") == NULL) { fprintf (stderr, "can't set LC_CTYPE to tr_TR.ISO8859-9\n"); exit (EXIT_FAILURE); } mpfr_init (x); mpfr_strtofr (x, "INFINITY", &endptr, 8, GMP_RNDN); mpfr_clear (x); printf (*endptr == '\0' ? "OK\n" : "Failed\n"); return 0; }

On implementations with

`long double`

numbers having more precision than the one declared by the`LDBL_MANT_DIG`

macro, like on Mac OS X (where the`long double`

arithmetic is implemented by double-double floating-point expansions), the rounded result returned by`mpfr_set_ld`

can be incorrect. Moreover, one of the tests is slightly incorrect too on such implementations. The second`mpfr_set_ld`

patch fixes these problems.The current semantic of

`mpfr_get_ld`

is to*round the result on*, thus returning a normalized floating-point result (as defined by the ISO C standard) if it can fit in the exponent range. This possibly unnecessary rounding is a feature, not a bug!`LDBL_MANT_DIG`

binary digitsNote that only C

*binary*floating-point arithmetics are currently supported for the conversions between MPFR numbers and C floating types. On other platforms (e.g. the TI-92, which has a decimal arithmetic), the results may be inaccurate.

In addition to the bugs mentioned in the `BUGS` file:

- There are possible bugs with huge precisions (greater than
2
^{30}) and with exponent ranges that do not allow to represent some numbers, such as 1 or 1/2. - In
`mpfr_get_ld`

, the rounding direction can be wrong if |`x`| <`LDBL_MIN`

. - The
`mpfr_hypot`

function is not described in the manual. It computes the Euclidean norm of the two input numbers`x`and`y`, i.e. √(`x`²+`y`²).

- Better way to detect the GMP library.
- Bug fixes.