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:
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). Under Microsoft Windows, in addition to the above options, you may need the --binary option (this depends whether the end-of-lines have been converted when you downloaded the patch file). Also note that the --dry-run option does not work with this cumulative patch.
svn co svn://scm.gforge.inria.fr/svn/mpfr/branches/2.2 mpfr-2.2In this case, as said on the Gforge page, you should read the README.dev file for details on how to build MPFR. Also note that the branch may contain additional minor fixes.
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:
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).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).mpfr_hypot
can be incorrect when the rounding
mode is to nearest, x is much largerthan y, and x is the middle of two consecutive numbers in the target precision (the patch provides a testcase for this bug).
mpfr_hypot
bug).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.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.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).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).mpn_sub_nc
(that led to
build errors in some cases, when a new version of GMP
was installed, but MPFR was not recompiled).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).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.
mpfr_log1p
and mpfr_expm1
values
for small negative input values (mpfr_expm1
may also be
incorrect on some small positive numbers).mpfr_expm1
function is very slow (several hours) and
may take several dozens of megabytes (gigabytes?) on large negative values,
as the exact result is very close to -1; this particular case is taken into
account by the patch.mpfr_exp2
function on some large
non-integer values (due to undetected overflow).mpfr_exp2
function gives an incorrect result on integers;
in practice, this should never happen, but anyway, this is a bug.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:
mpfr_csch
,
mpfr_sech
, mpfr_coth
, mpfr_eint
,
mpfr_erfc
and mpfr_zeta
.mpfr_pow_z
(thus mpfr_pow
too, when
mpfr_pow_z
is called) and mpfr_pow_si
, the
overflow and underflow flags are not always set.
Example: x = 0.11 in base 2,
y = 1.0e38, rounding-to-nearest mode.mpfr_pow
and mpfr_exp
.mpfr_set_d
concerning signed/unsigned types;
it should have no effects with most/all current compilers.mpfr_strtofr
with some specific
locales or compilers.In addition to the bugs mentioned in the BUGS file:
-DHAVE_ATTRIBUTE_MODE
by adding
CPPFLAGS="-DHAVE_ATTRIBUTE_MODE" to the configure
line (as explained by ./configure --help).Error in pow_si(x,x,-2) for x=2this may be a bug in your compiler, thus not an MPFR bug. Such a bug has been found in GCC preversions and in Sun's compiler for Solaris/x86 (when optimizations are enabled, which is the default when building MPFR).
mpfr_set_overflow
,
mpfr_set_underflow
,
mpfr_set_inexflag
,
mpfr_set_erangeflag
,
mpfr_set_nanflag
,
mpfr_erfc
,
mpfr_atan2
,
mpfr_pow_z
,
mpfr_subnormalize
,
mpfr_const_catalan
,
mpfr_sec
,
mpfr_csc
,
mpfr_cot
,
mpfr_root
,
mpfr_eint
,
mpfr_get_f
,
mpfr_sech
,
mpfr_csch
,
mpfr_coth
,
mpfr_lngamma
.MPFR_VERSION_STRING
.CC
and CFLAGS
from
GMP's Makefile if possible.long double
.mpfr_out_str
/
mpfr_get_str
when n_digits = 0.MPFR 2.2.0 has been successfully compiled and checked (with --enable-assert=full, in general) on the following platforms: