The canard à l'orange release, patch level 3.
MPFR 3.1.3 requires GMP 4.1.0 or higher (GMP 4.2.3 or higher is recommended).
Note: the bug-fix release MPFR 3.1.4 is available. Please upgrade!
Warning! Due to the fact that Thread-Local Storage
(TLS) support is now detected
automatically, the MPFR build can be incorrect on some
platforms (compiler or system bug). Indeed,
the
TLS implementation of some compilers/platforms is buggy,
and MPFR cannot detect every problem at configure time.
Please run make check
to see if your build is affected.
If you get failures, you should try the --disable-thread-safe
configure option to disable TLS and see if this solves
these failures. But you should not use an MPFR library
with TLS disabled in a multithreaded program (unless
you know what you are doing).
The MPFR 3.1.3 source can be downloaded in the following archive formats:
Each tarball is signed by Vincent Lefèvre. This can be verified using the DSA key ID 98C3739D; this key can be retrieved with:
gpg --recv-keys 98C3739D
or by downloading it from https://www.vinc17.net/pgp.html. The key fingerprint is:
07F3 DBBE CC1A 3960 5078 094D 980C 1976 98C3 739D
The signatures can be verified with:
gpg --verify file.asc
You should check that the key fingerprint matches.
MPFR is also available via third-party packages and ports.
The bugs listed below have been fixed (latest update: 2016-02-23). The patches are distributed under the same license as this version of MPFR, that is, the GNU Lesser General Public License (GNU Lesser GPL), version 3 or later.
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 if the cumulative patch has some file listed several times.
svn co svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1 mpfr-3.1(Warning! No authentication is done.) In 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
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, with patches:
mpfr_lngamma
function gives NaN instead of +Inf
on −0, on negative integers and on −Inf. This is fixed by the
lngamma-and-doc patch, which also fixes
and improves the tests and improves the MPFR manual
concerning the special values.mpfr_mul_2si
, mpfr_div_2ui
and
mpfr_div_2si
functions do not handle a potential overflow
when the integer argument is 0; such an overflow can occur only when the
output has less precision than the input, and this may yield a crash or
a number with an out-of-range exponent. This is fixed by the
muldiv-2exp-overflow patch,
which also provides testcases.mpfr_mul_2si
, mpfr_div_2ui
and
mpfr_div_2si
functions in rounding to nearest can round in
the wrong direction when the exact result is −2emin−2,
i.e. the middle of 0 and the minimum negative number in
absolute value. This is fixed by the
muldiv-2exp-underflow patch,
which also provides testcases.mpfr_frexp
function does not handle
internal overflow and it can yield an assertion failure when the
current exponent range does not contain 0. This is fixed by the
frexp patch,
which also provides testcases.mpfr_div
function can return an incorrect result. This is fixed by the
divhigh-basecase patch, which also
provides a testcase. Note that this bug is new in MPFR 3.1
and cannot be triggered with the mparam.h files
distributed in the tarball. Thus most users should not be affected.
However this bug may be visible after a make tune(which generates a new mparam.h file). More details in the discussion in the MPFR list.
mpfr_j0
, mpfr_j1
,
mpfr_jn
, mpfr_y0
, mpfr_y1
,
mpfr_yn
) can return an incorrect result. This is fixed by the
jn patch, which also provides a testcase.
Bug
report by Fredrik Johansson.mpfr_zeta
can return an
incorrect result when the argument is near an even negative integer. This
is fixed by the zeta patch, which also
provides a testcase.
Bug
report by Fredrik Johansson.mpfr_sqrt
can return invalid
data under very particular conditions: when the precision of the result is
a multiple of the number of bits per word (GMP_NUMB_BITS
), the
rounding mode is to nearest (MPFR_RNDN
), and internally, the
result has to be rounded up to a power of 2. This can yield assertion
failures (or other unknown behavior), thus make applications crash. This
is fixed by the sqrt patch, which also
provides a testcase.
Bug
report by Fredrik Johansson.mpfr_add_si
,
mpfr_sub_si
, mpfr_si_sub
, mpfr_mul_si
,
mpfr_div_si
, mpfr_si_div
) have undefined behavior
when the integer is the minimum one: LONG_MIN
. However,
on most processors (if not all), this bug has no visible effect when
MPFR is compiled in the usual way. It is visible
when using an undefined behavior sanitizer. This is fixed by the si-ops patch.
mpfr_can_round_raw
internal rounding-test
function can return true instead of false in case of a change of binade
(more specifically, exponent decrease) on the approximation interval.
This bug affects the mpfr_can_round
public function. Some
MPFR math functions might also be affected, but if
they are, errors should be very rare. Consequences can be inaccurate
results. This is fixed by the can_round
patch, which also provides testcases and cleans up related code.
Bug
report and discussion.mpfr_fits_*
functions
(mpfr_fits_ulong_p
, mpfr_fits_slong_p
,
mpfr_fits_uint_p
, etc.) can set some flags,
while the flags should not be modified. These functions can also trigger
assertion failures for non-integer numbers just above the positive limit
of the type when additional assertions are checked (MPFR
configured with --enable-assert). This is fixed by the
fits patch, which also provides
testcases.mpfr_root
function, which computes the
kth root of a floating-point number has major issues with large
values of k: MPFR can take much memory, and
when k is very large, MPFR can crash or the
function can return an incorrect result due to internal integer overflow.
This is fixed by the root patch, which
also provides testcases. This has been done by changing the algorithm for
k > 100.
Bug
report.mpfr_gamma
function has the following issues
when the argument is an integer fitting in an unsigned long
:
it may set the inexact flag even when the result is exact, and the result
may be incorrect in a very reduced exponent range. This is fixed by the
gamma patch, which also provides a
testcase.mpfr_fmod
, mpfr_remainder
or
mpfr_remquo
is called on arguments with a huge difference in
magnitude, MPFR can take much memory or crash. This is
fixed by the rem1 patch, which also
provides testcases.mpfr_agm
is called on arguments that have the
same value, the ternary value is set to 0, whether the result is exact or
not. This is fixed by the agm-eq patch,
which also provides a testcase.mpfr_sum
function can return wrong results
when not all the numbers have the same precision. This is fixed by the
sum patch, which also provides a testcase.
A side effect of this fix is that it can make mpfr_sum
much
slower and/or take much more memory in some of such cases with the same
program; this is normal and cannot easily be avoided with the current
algorithm.mpfr_sum_sort
internal
but exported function had to be changed. Since this function is used
only internally and by the tests, this does not break the
ABI. However the
old (3.1.3) and new tsum tests are source & binary incompatible.mpfr_cmp_d
(resp.
mpfr_cmp_ld
) function was setting the NaN flag when the
double
(resp. long double
) was
a NaN and could return an incorrect result (assertion failure in debug
mode) in reduced exponent range. This is fixed by the
cmp_d patch, which also provides
testcases.Other bugs: please see the tracker and the BUGS file.
MPFR 3.1.3 has been successfully compiled and checked on the following platforms: