MPFR 2.1.1 requires GMP 4.1.0 or higher.
MPFR 2.1.1 can be downloaded in the following archive formats:
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 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:
patch -N -Z -p1 < path_to_patches_filefrom the build directory. The -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).
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).
mpfr_exp_2
patch (with testcase).mpfr_add1sp
patch (with testcase).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).mpfr_pow_ui
function to evaluate
xn (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.mpfr_get_ld
with very small
numbers. This bug is fixed by the mpfr_get_ld
patch (with testcase).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.mpfr_div_ui
function is buggy. It is fixed in the
mpfr_div_ui
patch (with testcase).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).mpfr_add1
patch.mpfr_atan
function on -0 returns +0 instead of -0.
This bug is fixed by the mpfr_atan
patch
(with testcase).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
characters Iand
ido 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 LDBL_MANT_DIG
binary digits, 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!
Note 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:
mpfr_get_ld
, the rounding direction can be wrong
if |x| < LDBL_MIN
.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²).