MPFR 2.3.0 requires GMP 4.1.0 or higher.
The MPFR 2.3.0 source can be downloaded in the following archive formats:
Important note: If the MPFR build fails, please read the section In case of problem of the INSTALL file. In particular, GMP is known for using a different ABI from the default one on some 64-bit platforms, and in such a case, if you do not provide the same compiler flags as those automatically selected by GMP, things will probably go wrong, e.g. libgmp not found error message at configure time (this error message will be improved in future MPFR versions).
MPFR is also available via third-party packages and ports.
The bugs listed below have been fixed (latest update: 2008-01-22). 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 source 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); this may generate a
Not setting timewarning for the PATCHES file, but you can safely ignore it. 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.3 mpfr-2.3In 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.
With the first two ways, the PATCHES file is modified,
so that one can know what patches have been applied, using the new
mpfr_get_patches
function. Moreover a suffix is added to
the version string, but note that for practical reasons, not all the
files where the version appears are patched; thus one can also track
applied patches with the MPFR_VERSION_STRING
macro (header)
and the mpfr_get_version
function (library). However, if
some patches are not applied or if patches are applied in a different
order, then the patch command will fail to update some chunks, so that
the suffix is not always reliable for patches.
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_acosh
on arguments that
are slightly larger than 1. This bug can occur only if the precision of the
destination is strictly smaller than the precision of the input argument.
This is fixed by the mpfr_acosh patch
(with testcase).mpfr_atan2
and the second input argument is positive,
then mpfr_atan2
generally returns an incorrect result
(as if the result were an underflow). This is fixed by the
mpfr_atan2 patch (with testcase).mpfr_subnormalize
function sometimes returns
an incorrect result and assumes that emax - emin is
greater or equal to the precision of the MPFR number.
The mpfr_subnormalize patch fixes these
bugs, adds corresponding testcases and updates the MPFR
manual; the condition on the exponent range is replaced by: If the result cannot be represented in the current exponent range (due to a too small emax), the behavior is undefined.
Some other bugs have been found and fixed both in the trunk and in the 2.3 branch. The ones that may affect the user are listed below. The corresponding patches are not published (these bugs will be fixed in the future 2.3.1 release), but the changeset numbers (in the 2.3 branch) are given for the reference.
mpfr_acosh
function can fail with very large inputs
(due to an internal overflow). The above patch for inputs slightly larger
than 1 is probably incorrect (a small term was missing in the error
analysis); it has been rewritten, using a much simpler formula, which
also makes this case much faster.mpfr_sin_cos
function can return an incorrect result
if the input pointer and the pointer for the cosine are equal. Moreover,
it can be very slow on very small inputs.mpfr_sqrt
function when the result is inexact, and this function can yield
an assertion failure in an exponent range that does not contain
the value 1 (thus, very unlikely in practice).mpfr_sqr
function when the result is inexact.mpfr_sin
function can fail in a reduced exponent
range.mpfr_lgamma
and
mpfr_lngamma
on the values 1 and 2.mpfr_lgamma
and mpfr_lngamma
functions
loop on tiny inputs.mpfr_gamma
function applied on a huge integer fails
on 64-bit machines.mpfr_erfc
function is very inefficient on large
negative numbers.mpfr_zeta
function is incorrect on large negative
numbers (due to an internal overflow): the ternary value is wrong
(0 instead of non-zero), and the return value is also wrong in the
GMP_RNDU
rounding mode (-Inf instead of the largest
negative number).mpfr_mul
function reads uninitialized memory (but
allocated). Unless MPFR has been built with some tool
that does such a check (such as valgrind), this bug should
have no effect in practice.mpfr_div_ui
function applied on (±0, non-zero) does
not set the sign of the null result (this bug will not appear if the user
calls mpfr_div_ui(x, x, ...)
, i.e. if the input
and output pointers are equal).mpfr_j0
function applied on a large negative number
and the mpfr_jn
function applied on (even integer, large
negative number) return a result with a wrong sign.mpfr_cos
, which
can slightly be affected.mpfr_asin
function applied on ±0 does not set the sign
of the null result.mpfr_y1
function or the mpfr_yn
function with n = 1 is
called with the overflow flag set, it can yield a spurious overflow. If
the mpfr_cot
function is called with the underflow flag set,
it can yield an assertion failure.mpfr_sec
, mpfr_csc
, mpfr_cot
,
mpfr_sech
, mpfr_csch
and mpfr_coth
functions are called with the overflow flag set, they can return an
incorrect result (spurious overflow).mpfr_gamma
function can return a result with a
wrong sign (negative instead of positive) in case of underflow with
a positive value, e.g. on -1000000001.5 in the default
exponent range.mpfr_strtofr
documentation is ambiguous and the code
does not match the documentation on some particular points.Other bugs: please see the BUGS file.
mpfr_j0
, mpfr_j1
, mpfr_jn
,
mpfr_y0
, mpfr_y1
, mpfr_yn
,
mpfr_lgamma
, mpfr_remainder
,
mpfr_remquo
, mpfr_fms
, mpfr_signbit
,
mpfr_setsign
, mpfr_copysign
,
mpfr_get_patches
.mpfr_sin
, mpfr_cos
and
mpfr_sin_cos
improved (argument reduction).MPFR 2.3.0 has been successfully compiled and checked on the following platforms: