summaryrefslogtreecommitdiff
path: root/Build/source/libs
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs')
-rw-r--r--Build/source/libs/README2
-rw-r--r--Build/source/libs/mpfr/ChangeLog5
-rw-r--r--Build/source/libs/mpfr/TLpatches/ChangeLog6
-rw-r--r--Build/source/libs/mpfr/TLpatches/TL-Changes2
-rw-r--r--Build/source/libs/mpfr/TLpatches/patch-01-TL6
-rwxr-xr-xBuild/source/libs/mpfr/configure20
-rw-r--r--Build/source/libs/mpfr/mpfr-src/BUGS3
-rw-r--r--Build/source/libs/mpfr/mpfr-src/ChangeLog845
-rw-r--r--Build/source/libs/mpfr/mpfr-src/INSTALL8
-rw-r--r--Build/source/libs/mpfr/mpfr-src/NEWS8
-rw-r--r--Build/source/libs/mpfr/mpfr-src/VERSION2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/acinclude.m446
-rw-r--r--Build/source/libs/mpfr/mpfr-src/configure.ac49
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/Makefile.am2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/acos.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/acosh.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/acosu.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add_d.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add_ui.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/agm.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ai.c20
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/asin.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/asinh.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/asinu.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atan.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atan2.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atan2u.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atanh.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atanu.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cbrt.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/compound.c186
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/const_catalan.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/const_log2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/const_pi.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cos.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cosh.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cosu.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/d_div.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/d_sub.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/digamma.c14
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_2si.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_2ui.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_d.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_ui.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/eint.c10
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/erf.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/erfc.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exceptions.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp10m1.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp2.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp2m1.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp3.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp_2.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/expm1.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fma.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fmma.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/frexp.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/gamma.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_str.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/hypot.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/inp_str.c20
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/jn.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/li2.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/lngamma.c16
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log10.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log10p1.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log1p.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log2.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log2p1.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/modf.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h12
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h8
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h22
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr.h4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_2si.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_d.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow.c41
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow_si.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow_ui.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow_z.c8
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c9
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/reldiff.c32
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/root.c12
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_prec.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/si_op.c24
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sin.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sin_cos.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sinh.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sinu.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sqr.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sqrt.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/strtofr.c14
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub_d.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub_ui.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sum.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/tan.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/tanh.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/tanu.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ubf.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ui_div.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c59
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ui_sub.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/vasprintf.c54
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/version.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/yn.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/zeta.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c4
-rw-r--r--Build/source/libs/mpfr/version.ac2
118 files changed, 1496 insertions, 397 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README
index 68a3d97bc7f..355403d7c7f 100644
--- a/Build/source/libs/README
+++ b/Build/source/libs/README
@@ -46,7 +46,7 @@ lua 5.3.6 - checked 04oct20
luajit 2.1.0-beta3 - checked 20jun17
http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
-mpfr 4.2.0 - checked 12jan23
+mpfr 4.2.1 - checked 26aug23
http://ftp.gnu.org/gnu/mpfr/
pixman 0.42.2 - checked 03nov22
diff --git a/Build/source/libs/mpfr/ChangeLog b/Build/source/libs/mpfr/ChangeLog
index 275780af649..b48a4731ef7 100644
--- a/Build/source/libs/mpfr/ChangeLog
+++ b/Build/source/libs/mpfr/ChangeLog
@@ -1,3 +1,8 @@
+2023-08-26 Akira Kakuto <kakuto@jcom.zaq.ne.jp>
+
+ Import mpfr-4.2.1.
+ * version.ac: Adjust.
+
2023-01-12 Akira Kakuto <kakuto@jcom.zaq.ne.jp>
Import mpfr-4.2.0.
diff --git a/Build/source/libs/mpfr/TLpatches/ChangeLog b/Build/source/libs/mpfr/TLpatches/ChangeLog
index e87608ce671..157fb88c3fa 100644
--- a/Build/source/libs/mpfr/TLpatches/ChangeLog
+++ b/Build/source/libs/mpfr/TLpatches/ChangeLog
@@ -1,3 +1,9 @@
+2023-08-26 Akira Kakuto <kakuto@jcom.zaq.ne.jp>
+
+ Imported mpfr-4.2.1 source tree from:
+ http://ftp.gnu.org/gnu/mpfr/
+ * patch-01-TL: Adapted.
+
2023-01-12 Akira Kakuto <kakuto@jcom.zaq.ne.jp>
Imported mpfr-4.2.0 source tree from:
diff --git a/Build/source/libs/mpfr/TLpatches/TL-Changes b/Build/source/libs/mpfr/TLpatches/TL-Changes
index 210b5c8f9bf..cd2109b4f09 100644
--- a/Build/source/libs/mpfr/TLpatches/TL-Changes
+++ b/Build/source/libs/mpfr/TLpatches/TL-Changes
@@ -1,4 +1,4 @@
-Changes applied to the mpfr-4.2.0/ tree as obtained from:
+Changes applied to the mpfr-4.2.1/ tree as obtained from:
http://ftp.gnu.org/gnu/mpfr/
Removed:
diff --git a/Build/source/libs/mpfr/TLpatches/patch-01-TL b/Build/source/libs/mpfr/TLpatches/patch-01-TL
index af4dfd9d71e..785c8fc235b 100644
--- a/Build/source/libs/mpfr/TLpatches/patch-01-TL
+++ b/Build/source/libs/mpfr/TLpatches/patch-01-TL
@@ -1,6 +1,6 @@
-diff -ur mpfr-4.2.0/src/mparam_h.in mpfr-src/src/mparam_h.in
---- mpfr-4.2.0/src/mparam_h.in Fri Jan 06 02:09:48 2023
-+++ mpfr-src/src/mparam_h.in Thu Jan 12 13:20:19 2023
+diff -ur mpfr-4.2.1/src/mparam_h.in mpfr-src/src/mparam_h.in
+--- mpfr-4.2.1/src/mparam_h.in Fri Jan 06 02:09:48 2023
++++ mpfr-src/src/mparam_h.in Sat Aug 26 13:05:08 2023
@@ -38,6 +38,8 @@
-march=... and -mtune=...).
See https://gcc.gnu.org/pipermail/gcc-help/2021-September/140720.html */
diff --git a/Build/source/libs/mpfr/configure b/Build/source/libs/mpfr/configure
index 7a5796408e6..c490f8160c3 100755
--- a/Build/source/libs/mpfr/configure
+++ b/Build/source/libs/mpfr/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for mpfr (TeX Live) 4.2.0.
+# Generated by GNU Autoconf 2.71 for mpfr (TeX Live) 4.2.1.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -610,8 +610,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='mpfr (TeX Live)'
PACKAGE_TARNAME='mpfr--tex-live-'
-PACKAGE_VERSION='4.2.0'
-PACKAGE_STRING='mpfr (TeX Live) 4.2.0'
+PACKAGE_VERSION='4.2.1'
+PACKAGE_STRING='mpfr (TeX Live) 4.2.1'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
@@ -1329,7 +1329,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures mpfr (TeX Live) 4.2.0 to adapt to many kinds of systems.
+\`configure' configures mpfr (TeX Live) 4.2.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1400,7 +1400,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of mpfr (TeX Live) 4.2.0:";;
+ short | recursive ) echo "Configuration of mpfr (TeX Live) 4.2.1:";;
esac
cat <<\_ACEOF
@@ -1504,7 +1504,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-mpfr (TeX Live) configure 4.2.0
+mpfr (TeX Live) configure 4.2.1
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1874,7 +1874,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by mpfr (TeX Live) $as_me 4.2.0, which was
+It was created by mpfr (TeX Live) $as_me 4.2.1, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -4418,7 +4418,7 @@ fi
# Define the identity of the package.
PACKAGE='mpfr--tex-live-'
- VERSION='4.2.0'
+ VERSION='4.2.1'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -8072,7 +8072,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by mpfr (TeX Live) $as_me 4.2.0, which was
+This file was extended by mpfr (TeX Live) $as_me 4.2.1, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8144,7 +8144,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-mpfr (TeX Live) config.status 4.2.0
+mpfr (TeX Live) config.status 4.2.1
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/libs/mpfr/mpfr-src/BUGS b/Build/source/libs/mpfr/mpfr-src/BUGS
index aa301f9d43e..6ed18a9512f 100644
--- a/Build/source/libs/mpfr/mpfr-src/BUGS
+++ b/Build/source/libs/mpfr/mpfr-src/BUGS
@@ -39,6 +39,9 @@ Known bugs:
between parameters' exponents is near 2*MPFR_EMAX_MAX and on the other hand
the output precision or the precision of the parameter with greatest
absolute value is greater than 2*MPFR_EMAX_MAX-4.
+ Note: Such huge precisions are not possible as they would be larger than
+ MPFR_PREC_MAX, unless the types for mpfr_exp_t and/or mpfr_prec_t are
+ changed (only for developers or expert users, not officially supported).
Potential bugs:
diff --git a/Build/source/libs/mpfr/mpfr-src/ChangeLog b/Build/source/libs/mpfr/mpfr-src/ChangeLog
index 4ee0900c2e2..9708b1ee95f 100644
--- a/Build/source/libs/mpfr/mpfr-src/ChangeLog
+++ b/Build/source/libs/mpfr/mpfr-src/ChangeLog
@@ -1,5 +1,850 @@
+2023-08-22 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated version to 4.2.1.
+
+2023-08-18 Vincent Lefevre <vincent@vinc17.net>
+
+ ChangeLog update with tools/update-changelog
+
+ [tools/gitlog-to-changelog] Improve --strip-cherry-pick for this repository.
+
+ Updated version to 4.2.1-rc1.
+
+2023-08-18 Vincent Lefevre <vincent@vinc17.net>
+
+ [configure.ac] More checks for the support of old dtags.
+
+ There is an attempt to use the old dtags when LD_LIBRARY_PATH is
+ defined in order to avoid issues with the testsuite when this path
+ contains some compatible version of the MPFR library. However, the
+ old dtags do not work everywhere at run time, even when they appear
+ to work at link time (via -Wl,--disable-new-dtags).
+
+ So, let's restrict to *-*-linux-gnu hosts. Unfortunately, this is
+ not sufficient for Android/Termux, where config.guess currently
+ identifies the host as GNU/Linux (matching *-*-linux-gnu) instead of
+ Android, but the old dtags do not work at run time. So, let's also
+ exclude Termux explicitly (a test to exclude all Android hosts would
+ be better, though).
+
+ Note: in most cases, LD_LIBRARY_PATH is not set, so that there should
+ be no issues in practice.
+
+2023-08-18 Vincent Lefevre <vincent@vinc17.net>
+
+ [NEWS] Update for 4.2.1
+
+2023-08-18 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/compound.c] Removed obsolete FIXME.
+
+ The implementation changed in 63cc8dfaf4dd93d68bb4f12c0787046f8a525893
+ (cherry picked in 952fb0f5cc2df1fffde3eb54c462fdae5f123ea6).
+
+2023-08-17 Vincent Lefevre <vincent@vinc17.net>
+
+ [strtofr.c] Fixed 2 mpfr_strtofr bugs in case of huge negative exponent.
+
+ This fixes the bugs triggered by bug20230606, mentioned at
+ https://sympa.inria.fr/sympa/arc/mpfr/2023-06/msg00000.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2023-06/msg00001.html
+
+ These bugs are integer overflows, meaning undefined behavior.
+ In practice, the consequences may be incorrect results. But
+ for the first bug, it has been seen that a GCC optimization
+ makes the bug invisible.
+
+ Note: There are other issues with the code for huge exponents
+ (in strtofr.c and the MPFR_SADD_OVERFLOW macro from mpfr-impl.h).
+ See FIXME from commits
+ aa30bfe3c868640852fa2510b0f228170e39c0c5
+ e06a073c157fe95dd24d16d9fc3eef3781b58795
+ in master. But it is not clear whether the problematic cases can
+ occur in the context of mpfr_strtofr: my attempts to trigger a
+ problematic case failed, so that there is a chance that the code
+ is actually correct; but many parameters are involved, including
+ those based on the internal structure in limbs, so that it is
+ difficult to say for now. A closer analysis needs to be done.
+ Even if correct, the code would need to be cleaned up, proved,
+ and better documented.
+
+2023-08-17 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tstrtofr.c] Added testcases for mpfr_strtofr integer overflows.
+
+ These bugs occur on inputs with a large negative exponents, such as
+ "0.1E-99999999999999999999".
+
+ A first bug was reported by Michael Jones at
+ https://sympa.inria.fr/sympa/arc/mpfr/2023-06/msg00000.html
+
+ Second bug mentioned at
+ https://sympa.inria.fr/sympa/arc/mpfr/2023-06/msg00001.html
+
+2023-08-16 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+2023-08-15 Vincent Lefevre <vincent@vinc17.net>
+
+ Formatted output functions: fixed ‘+’/space flags on NaN and Inf.
+
+ This is about the documentation and behavior of the mpfr_printf,
+ etc. functions on MPFR numbers (mpfr_t) only, i.e. with the ‘R’
+ type specifier.
+
+ The ‘+’ and space flags were ignored on NaN and Inf. While this
+ was loosely documented as such (without an explicit mention of
+ these flags), the GNU MPFR manual also says that the flags have
+ the same meaning as for the standard ‘printf’ function. So this
+ was contradictory and regarded as a bug.
+
+ Behaving like the ISO C standard should give less surprise, and
+ this is probably what is expected (better for alignment purpose).
+
+ This was partly discussed at
+ https://sympa.inria.fr/sympa/arc/mpfr/2023-03/msg00003.html
+ (only for NaN and the ‘+’ flag at that time).
+
+ * doc/mpfr.texi: corrected the documentation.
+ * src/vasprintf.c: fixed (the code is now simpler since the rule
+ is the same in all cases: real and non-real values).
+ * tests/tsprintf.c: grouped all the tests of NaN and Inf, and
+ added much more tests (by constructing the format string in
+ nested loops instead of just a few hardcoded cases).
+
+2023-08-15 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/vasprintf.c] Coding style.
+
+2023-08-10 Vincent Lefevre <vincent@vinc17.net>
+
+ [configure.ac] For libgmp, replaced AC_CHECK_LIB by our own link test.
+
+ The issue with AC_CHECK_LIB is that it cannot know the prototype of
+ mpz_init. Thus it declares the function without a prototype, which
+ is obsolescent in ISO C, so that the compiler may complain (e.g.
+ with GCC's -Werror=strict-prototypes option, which may be useful to
+ detect bugs in MPFR). Moreover, the call is done with an incorrect
+ prototype, which could also be an issue on some systems (currently,
+ no prototype check is done when linking, but this might change in
+ the future).
+
+ Note also that this new test is more robust, in case GMP changes the
+ symbol name in the future (the API does not need to be changed).
+
+ For the reference:
+ https://sympa.inria.fr/sympa/arc/mpfr/2023-08/msg00003.html
+
+2023-08-10 Vincent Lefevre <vincent@vinc17.net>
+
+ [configure.ac] Do the MPFR_CHECK_MP_LIMB_T_VS_* tests without -lgmp.
+
+ Moved the two tests
+
+ MPFR_CHECK_MP_LIMB_T_VS_LONG
+ MPFR_CHECK_MP_LIMB_T_VS_INTMAX
+
+ before the LIBS="-lgmp $LIBS" as linking with GMP is not needed for
+ these tests (only mp_limb_t is used from gmp.h), and it is actually
+ better not to link with GMP. Indeed, as said for these tests, which
+ use AC_LINK_IFELSE:
+
+ AC_LINK_IFELSE is safer than AC_COMPILE_IFELSE, as it will detect
+ undefined function-like macros (which otherwise may be regarded
+ as valid function calls with AC_COMPILE_IFELSE since prototypes
+ are not required by the C standard).
+
+ So linking with GMP could make a failure disappear in case of a bug
+ somewhere, so that the bug could remain undetected.
+
+2023-08-10 Vincent Lefevre <vincent@vinc17.net>
+
+ [acinclude.m4] Replaced <gmp.h> by "gmp.h" for #include.
+
+ The tests from configure.ac all use #include "gmp.h", and for the
+ MPFR build and tests, gmp.h is also included with #include "gmp.h"
+ (by mpfr-impl.h). For consistency, do the same in acinclude.m4.
+
+ Note: In practice, there should not be a difference, except if there
+ is a gmp.h file somewhere in the MPFR build tree. But this is not
+ supported, and this may break the build or the testsuite (whatever
+ is used in the configure tests).
+
+2023-07-19 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/mpfr-gmp.h] Fix integer overflow when mp_limb_t < int (mini-gmp).
+
+ When mp_limb_t is shorter than int (which is possible with mini-gmp),
+ an integer promotion in udiv_qr_3by2 triggers an integer overflow,
+ detected by testing MPFR with
+
+ ./configure --with-mini-gmp=/path/to/mini-gmp CC=gcc-13 \
+ CFLAGS="-O2 -fsanitize=undefined -fno-sanitize-recover
+ -DMINI_GMP_LIMB_TYPE=short"
+
+ (many tests fail).
+
+ Note that this is not detected by GCC 12 and before, probably due to
+ an optimization bug that hides the UBsan error.
+
+ Moreover, mini-gmp currently has the same bug in gmp_udiv_qr_3by2,
+ but also in gmp_udiv_qrnnd_preinv; it needs to be fixed too in order
+ to avoid the failures in the MPFR tests.
+
+2023-07-19 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/trint.c] C2x compat: replaced function without a prototype.
+
+ The second parameter of test_fct was "int (*g)()", i.e. a pointer to
+ a function without a prototype, because 2 kinds of prototypes can be
+ used:
+ * one with args (mpfr_ptr, mpfr_srcptr);
+ * one with args (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t),
+ but only for mpfr_rint.
+ This was not a problem thanks to the test "g == &mpfr_rint", i.e.
+ we knew which one to use. However, as the Clang 16 warning message
+ says for -Wdeprecated-non-prototype:
+ "passing arguments to a function without a prototype is deprecated
+ in all versions of C and is not supported in C2x".
+
+ The best way to fix this is to use the prototype with 2 arguments
+ (mpfr_ptr, mpfr_srcptr) for the parameter, as this is the general
+ case. All we need to do is to cast &mpfr_rint to this prototype
+ (this appears only twice).
+
+ As these casts trigger the -Wcast-function-type warning when enabled,
+ let's explicitly disable this warning for GCC and Clang in versions
+ where it has been introduced.
+
+2023-07-18 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tfpif.c] Removed "fclose (fh);" under "if (fh == NULL)".
+
+ The fopen() failed, so fclose() is not needed, and this is even UB.
+
+ Issue reported by Jerry James:
+ https://sympa.inria.fr/sympa/arc/mpfr/2023-07/msg00002.html
+ as GNU libc recently added a "nonnull" function attribute:
+ https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=71d9e0fe766a3c22a730995b9d024960970670af
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+ [src/inp_str.c] Resolved the FIXME on a deprecated use of ungetc.
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ Fixed mpfr_strtofr bug in parse_string when isspace(0) is true.
+
+ When isspace(0) is true (allowed by ISO C for non-"C" locales), '\0'
+ would be skipped if part of the leading whitespace. But it must be
+ regarded as the terminating null character, from the definition of
+ a string (before the notion of whitespace is involved). So let's
+ stop explicitly on '\0'.
+
+ Note: in such locales (Mutt's lib.h suggests that some systems are
+ affected, but this was in 1998), this is a security vulnerability,
+ because characters after the terminating null character are read to
+ determine the result.
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [inp_str.c] mpfr_inp_str: fixed the handling of '\0' in the word.
+
+ When '\0' is not a whitespace character (which is almost always the
+ case in practice), it was not handled correctly. For instance, if the
+ word is the sequence { '1', '\0', '2' }, the string "1" was passed to
+ mpfr_set_str because '\0' is regarded as a terminating null character,
+ and one was getting a valid number while '\0' in a word is necessarily
+ invalid. This is fixed by putting '*' at the beginning of the string,
+ which is thus necessarily invalid.
+
+ This fixes the failure after c9523bc6fb11c8eefc75524e947e5eb81e682675
+ (4642e68fb3cd6793a51537cfc86a7cb3ef1c0a4c in the 4.2 branch).
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/inp_str.dat] Make the word that contains '\0' look like a number.
+
+ Changed ".\0." to "1\01" (\0 being the null character) in order to
+ trigger a failure with the current mpfr_inp_str code. The issue is
+ that '\0' makes the word look like the string "1", the '\0' being
+ regarded as a terminating null character. This is incorrect as '\0'
+ is part of the full word.
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [manual] Clarified the return value of mpfr_inp_str.
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ Added a '\0' test for mpfr_inp_str.
+
+ After ensuring that isspace(0) is false, make sure that '\0' is
+ handled as a normal non-whitespace character.
+
+ Also note that inp_str.dat does not end with a newline character
+ on purpose, in order to check that a number at the end of the file
+ (with no whitespace after it) is handled correctly.
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ Improved the mpfr_inp_str tests.
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/inp_str.dat] Added the other standard whitespace characters.
+
+ These are:
+ * space (' ');
+ * ^I (horizontal tab '\t');
+ * ^J (newline '\n', already there);
+ * ^K (vertical tab '\v');
+ * ^L (form feed '\f');
+ * ^M (carriage return '\r').
+
+2023-07-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [MPFR manual] Corrected description of mpfr_inp_str.
+
+ The description seemed to assume that there was leading and trailing
+ whitespace (due to "between whitespace"). Also clarify what whitespace
+ is: defined by isspace(), which depends on the current locale.
+
+2023-06-26 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tfpif.c] Workaround for GCC bug 106155.
+
+ This GCC bug is:
+ [12/13/14 Regression] spurious "may be used uninitialized" warning
+
+ This bug appeared in GCC 12, but it is more serious in GCC 13
+ (at least for tfpif.c), which warns also at -O2:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106155#c12
+
+ Silencing this warning avoids an error when -Werror is used.
+
+2023-06-26 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/pow.c] Typo detected by codespell.
+
+2023-05-26 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] Fixed large_prec_for_g with 32-bit mpfr_intmax_t.
+
+ If mpfr_intmax_t is a 32-bit type (meaning that int is a 32-bit type
+ too), then allow a failure on "%.2147483648Rg" (return value < 0),
+ due to a (reasonable) limit on the current implementation.
+
+ This can currently be tested with
+ -std=c90 -Werror -pedantic -Wformat -Wno-error=overlength-strings
+
+2023-05-25 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] large_prec_for_g: C++ compatibility.
+
+ Note that after this change, the test is still meaningful.
+
+2023-05-23 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] Improved large_prec_for_g even more.
+
+2023-05-23 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] A few more tests for large_prec_for_g.
+
+ ... to really check that the results are correct.
+
+2023-05-22 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/trec_sqrt.c] Updated bad_case3() test.
+
+ Also check the result, though this is not the real purpose of
+ this test (the purpose is to detect a stack overflow, which
+ just makes the program crash).
+
+2023-05-22 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/trec_sqrt.c] Added bad_case3() test.
+
+ Simple hardcoded test for the stack overflow bug fixed on 2023-04-17
+ in commits
+ 270f4df6b3a49caae1cf564dcdc1c55b1c5989eb (master)
+ 934dd8842b4bdeb919a73123203bc8ce56db38d1 (4.2 branch)
+
+ Otherwise, this bug was triggered by a generic bad_cases() test,
+ based on random values.
+
+2023-05-22 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests.c] In bad_cases(), improved alignment in debug messages.
+
+ Needed as some trec_sqrt tests use a precision with up to 6 digits.
+
+2023-05-17 Vincent Lefevre <vincent@vinc17.net>
+
+ [tcompound.c] Updated comment for bug_20230517.
+
+ Similar to b8ee84929ef6caf66d7c694cf74534b7190339c5 in master.
+
+2023-05-17 Vincent Lefevre <vincent@vinc17.net>
+
+ [compound.c] Improved tests and corresponding comment.
+
+ [compound.c] Avoid a possible integer overflow; other improvements.
+
+2023-05-17 Vincent Lefevre <vincent@vinc17.net>
+
+ [tcompound.c] Added bug_20230517 (integer overflow in compound.c).
+
+ and updated comment for the 4.2 branch.
+
+2023-05-16 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/vasprintf.c] Fixed bug triggered by the large_prec_for_g test.
+
+ Bug fixes in partition_number():
+ * Fixed the type of the variable `threshold`: as this variable may
+ contain spec.prec, it needs to be of type mpfr_intmax_t.
+ This was the cause of the "MPFR assertion failed: threshold >= 1"
+ (or the incorrect size when assertions are not checked) with the
+ large_prec_for_g test.
+ * Also make sure that the 4th argument given to mpfr_get_str fits
+ in a size_t (if it doesn't, return with a failure, as done when
+ reaching other environmental limits).
+ In practice, this could be an issue only with a 32-bit size_t and
+ mpfr_exp_t on more than 32 bits.
+
+2023-05-16 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] Added large_prec_for_g, which makes MPFR crash.
+
+ On a 64-bit Linux machine, the case %.2147483648Rg yields an incorrect
+ size computation and MPFR wants to allocate 18446744071562070545 bytes.
+ This case should either succeed or fail as reaching an environmental
+ limit like with glibc (note that the precision does not fit in an int).
+
+2023-05-16 Vincent Lefevre <vincent@vinc17.net>
+
+ [manual] Detailed mpfr_compound_si description (special cases).
+
+ The MPFR manual should be self-contained. So, let's describe
+ the special cases of mpfr_compound_si that do not follow the
+ usual rules (or are ambiguous), instead of just referring to
+ the IEEE 754 standard.
+
+2023-05-16 Vincent Lefevre <vincent@vinc17.net>
+
+ [compound.c] Fixes concerning the overflow and underflow detection.
+
+ Note: It is not clear whether overflow and underflow detection is
+ now correct. There may still be potential issues, but currently,
+ after these fixes, no tests yield any failure (however, we do not
+ test some of the most problematic cases yet; this should be a
+ future improvement of ofuf_thresholds in the master branch).
+
+ Note: compound.c now corresponds to the version in master.
+
+2023-05-16 Vincent Lefevre <vincent@vinc17.net>
+
+ [tcompound.c] Added various tests.
+
+ * Added bug_20230206, based on a bug report by Patrick Pélissier.
+ * Implemented the inverse function x^(1/n) - 1 of the compound function
+ on non-special cases: useful to build and check hard-to-round cases
+ and test the behavior close to the overflow and underflow thresholds.
+ * Check hard-to-round cases for n = 2, 3, 4, 5, 17, 120 (like in tpow.c)
+ and also call the generic tests for these values.
+ * Added bug_20230211 (buggy overflow detection for 32 bits after the
+ fix of bug_20230206 in master).
+
+ and updated two comments for the 4.2 branch.
+
+ Note: Every change has been cherry picked from master, except a
+ TODO comment and the ofuf_thresholds() calls (feature not yet in
+ the 4.2 branch). And bug_20230206 has not been fixed yet in the
+ 4.2 branch.
+
+2023-05-15 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests.c] In bad_cases(), handle the inex_inv case better.
+
+ The "f exact while f^(-1) inexact" case is actually almost the same
+ as the "inverse doesn't match" case. So, handle it in the same way,
+ avoiding a fatal error (which would be bad for the non-developers):
+ a few occurrences of this case should be regarded as normal, and if
+ this occurs too often, this will be detected like the other case
+ when the MPFR_CHECK_BADCASES environment variable is set.
+
+ This is useful for future bad_cases() calls.
+
+2023-05-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/pow.c] Fixed a corner case in mpfr_pow_general (bug20230427).
+
+ This fixes the bug triggered by bug20230427 added in commit 85bc7331c:
+ bug20230427 triggers another bug in mpfr_pow_general, which
+ occurs in destination precision 1 in the particular case of
+ rounding to nearest, z * 2^k = 2^(emin - 2) and real result
+ larger than this value.
+
+ This corresponds to a particular hunk of a diff from master,
+ or with a cherry-pick from commits
+ ef31bb98521ecf7d100593346e2f4d7a7724c573
+ 27bc582645e513200c56c99a9da83eb4e47c669a
+ e1f9f14a3829081503c027f4d38eb51778da26e6
+ ff5012b61d5e5fee5156c57b8aa8fc1739c2a771
+ 3b63024c640181cb5fe7fd87bac94a8f942a07da
+ 4f5de980be290687ac1409aa02873e9e0dd1a030
+ 467b17025a5b05e888ed7117d6730ac0954f01cb
+ restoring the changes not related to this hunk.
+
+2023-05-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/pow.c] Fixed error bound in mpfr_pow_general (bug20230213).
+
+ This fixes the bug triggered by bug20230213 added in commit 85bc7331c:
+ bug20230213 triggers a bug in mpfr_pow_general, where the
+ computation of the error term is incorrect when there has
+ been an intermediate underflow or overflow (k_non_zero is
+ true); the error analysis is correct, but the associated
+ code is not (due to the change of the value of a variable).
+
+2023-05-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/texp10.c] Added bug20230213 and bug20230427 tests.
+
+ * bug20230213 triggers a bug in mpfr_pow_general, where the
+ computation of the error term is incorrect when there has
+ been an intermediate underflow or overflow (k_non_zero is
+ true); the error analysis is correct, but the associated
+ code is not (due to the change of the value of a variable).
+ * bug20230427 triggers another bug in mpfr_pow_general, which
+ occurs in destination precision 1 in the particular case of
+ rounding to nearest, z * 2^k = 2^(emin - 2) and real result
+ larger than this value.
+
+ Note: The code has been copied from master (and because of changes
+ of other parts of the code by commits in master, cherry-picking
+ was impossible or much more complex). These bugs have been fixed
+ in master, but these fixes will be provided in the 4.2 branch by
+ separate commits in order to facilitate testing (e.g., to check
+ that one gets failures without these fixes).
+
+ Both bugs were found by the current ofuf_thresholds tests in master
+ (but there are currently issues with these tests).
+
+2023-05-12 Vincent Lefevre <vincent@vinc17.net>
+
+ Added bad_cases tests for mpfr_exp2, mpfr_exp10, mpfr_log2, mpfr_log10.
+
+ [tests/tui_pow.c] Added generic tests.
+
+ Added /treldiff to tests/.gitignore
+
+2023-05-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tui_pow.c] Some small corrections.
+
+ * Improved organization and style.
+ * Replaced output to stderr by output to stdout (as usual).
+ * Added missing "\n" at the end of 2 printf strings.
+
+2023-05-05 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tset_float128.c] check_special(): output values in error messages.
+
+2023-05-04 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+ [src/Makefile.am] Updated -version-info to 8:1:2 for MPFR 4.2.1.
+
+2023-05-04 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated version to 4.2.1-dev (with tools/update-version).
+
+ This should have been done just after 4.2.0 was published,
+ i.e. just after the 4.2.0 tag, but I forgot.
+
+2023-05-04 Vincent Lefevre <vincent@vinc17.net>
+
+ Added treldiff.c test, assuming that mpfr_reldiff behaves as documented.
+
+ Basically, mpfr_reldiff is tested with all special numbers and some
+ regular ones, with various precisions and all the rounding modes
+ (including MPFR_RNDF since in practice, the implementation cannot
+ exploit it to give failures). The result is just compared with the
+ basic algorithm (as documented), which does not use any optimization
+ (i.e. it does not treat special numbers in a particular way): the
+ formula is just computed using the precision of the destination and
+ the provided rounding mode for all operations (thus, in general,
+ this mpfr_reldiff function is not correctly rounded).
+
+ This test would detect the bugs on special values that have been fixed
+ in 81e4d4427eed0404292ac69c17f986a6cb640562.
+
+2023-05-04 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/reldiff.c] Fixed mpfr_reldiff on special values.
+
+ The mpfr_reldiff function, which computes |b-c|/b, was buggy on
+ special values, e.g. on the following (b,c) values:
+ * (+Inf,+Inf) gave ±0 instead of NaN (like NaN/Inf).
+ * (+0,+0) gave 1 instead of NaN (like 0/0).
+ * (+0,1) gave 1 instead of Inf (like 1/0).
+
+ The sign of 0 for (+Inf,+Inf) or (-Inf,-Inf) was not set, i.e. it
+ was just the sign of the destination before the call. This made
+ the "reuse" test fail after its update to check the sign of zero
+ (commit e6d47b8f5ab666e658e05fe282e3490a06c0278e), as the results
+ were not consistent.
+
+ For b = 0, there was a comment "reldiff = abs(c)/c = sign(c)", which
+ mixed up b and c (one should divide by b, not by c), and this could
+ explain some bugs.
+
+ Note that this comment (and associated code), if corrected, seemed to
+ imply that for c = 0 and b finite (and non-zero?), the intent was to
+ return sign(b). However, this does not follow the documentation, which
+ says that the formula is just computed using the precision of the
+ destination and the provided rounding mode for all operations. So the
+ final result may be affected by intermediate roundings, while sign(b)
+ assumes that the function is correctly rounded, which is not the case
+ for this function (just there for compatibility with MPF). Deviating
+ from the documentation in some cases could break some properties (like
+ monotonicity?).
+
+ These bugs were not found because mpfr_reldiff is not tested at all,
+ except by "reuse", which just checks some consistency when a variable
+ is reused for the destination.
+
+2023-05-04 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/reuse.c] Check the sign of zero; other improvements.
+
+ * Replaced the static mpfr_compare by "! SAME_VAL" to do a complete
+ comparison of MPFR numbers. In particular, this checks the sign of
+ zero, revealing a bug in mpfr_reldiff (failure 0 vs -0).
+ * More consistent output of errors (use of mpfr_dump for ref and res
+ in all cases).
+ * Code style.
+
+2023-04-20 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] Updated comment for snprintf_size.
+
+ Like commit 524c7bf4ff4f0dc1c83bc9a36d621a4a9607ee3b in master,
+ but without the "Code reworked..." line, as this isn't done in
+ the 4.2 branch.
+
+2023-04-17 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] Update about the glibc 2.37 bug.
+
+ This updates commit 78ff7526dea103f73acc98d9a9ffa7429050c0dd.
+
+2023-04-17 Vincent Lefevre <vincent@vinc17.net>
+
+ Fixed possible stack overflow in mpfr_rec_sqrt + non-regression test.
+
+ * src/rec_sqrt.c: use a standard Ziv loop.
+ * tests/trec_sqrt.c: added a non-regression test with bad_cases().
+
+ Details:
+
+ The issue is due to many allocations in the stack (with alloca(),
+ via MPFR_TMP_LIMBS_ALLOC) on cases that are very hard to round (from
+ an analysis on a testcase given by Fredrik Johansson, not included
+ here) with a not too large destination precision: many iterations
+ are needed due to a specific Ziv loop where the working precision
+ is increased additively, and it is not possible to free the data
+ allocated in the previous iterations.
+
+ The fix is to use a standard Ziv loop, as it increases the working
+ precision multiplicatively instead of additively, so that it needs
+ much fewer iterations in such cases. This should also make the code
+ much faster in such cases.
+
+ This issue was not detected by bad_cases() in tests/trec_sqrt.c
+ because to be able to reproduce it, one needs a much larger precision
+ than the ones tested with the chosen parameters.
+
+ A new bad_cases() instance, with a large enough precision for the
+ input (py = 9999, psup = 120000, giving px = py + psup = 129999),
+ is added here in order to be able to reproduce the failure.
+
+ The testcase given by Fredrik Johansson is not included here because
+ it uses a very large string for the input (the point of bad_cases()
+ is to generate such an input automatically).
+
+2023-04-15 Vincent Lefevre <vincent@vinc17.net>
+
+ [src] Since mpfr_prec_t is signed, changed %Pu to %Pd.
+
+ Note: Even the mpfr_prec_t is not supposed to contain negative values
+ (at least in these cases), this may still be useful in case of bugs.
+
+2023-04-14 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+2023-04-14 Vincent Lefevre <vincent@vinc17.net>
+
+ [manual] Improved example on how to print a mpfr_prec_t value.
+
+ mpfr_prec_t is signed, so that it is better to use %Pd than %Pu.
+
+2023-04-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/mpfr-thread.h] Output a message in case of lock/unlock failure.
+
+ The message is output just before abort(), so that one can know
+ the cause of the abort().
+
+ Tested with --enable-shared-cache CC=i686-w64-mingw32-gcc-posix
+ (which has the effect to enable POSIX threads inside MPFR via
+ AX_PTHREAD, with MinGW), where
+
+ MPFR_LOCK_DECL(mpfr_lock_memory)
+ int main (void)
+ {
+ MPFR_LOCK_WRITE(mpfr_lock_memory);
+ return 0;
+ }
+
+ fails with the "MPFR lock failure" message and exit status 3 due to
+ the abort(). Note that there is no failure with GNU/Linux.
+
+2023-03-22 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+ [manual] Detailed mpfr_set_str a bit more.
+
+2023-02-28 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests] Added/improved tests for the log, log2 and log10 functions.
+
+ * Added log(1) test.
+ * For the special tests of these functions: test in all rounding modes
+ and use MPFR_IS_ZERO(x) rather than mpfr_cmp_ui(x,0) to exclude NaN.
+
+2023-02-21 Vincent Lefevre <vincent@vinc17.net>
+
+ Fixed mpfr_ui_pow_ui infinite loop in case of overflow, with testcases.
+
+ * src/ui_pow_ui.c:
+ - Cleanup. In particular, renamed a variable as this was confusing:
+ one usually uses y = f(x), but here it was x = f(y,n). Let's use
+ x = f(k,n) since here, both arguments are integers.
+ - Added mpfr_ui_pow_ui logging.
+ - Handle the +Inf case in the Ziv iteration.
+ This is done by calling mpfr_pow_z (this should be a bit more
+ efficient than calling mpfr_pow_ui, which would eventually call
+ mpfr_pow_z to handle the overflow).
+ Note that mpfr_pow_z avoids spurious overflows by internally
+ rounding toward 1 (for positive results). This might be an
+ alternative solution here to avoid calling mpfr_pow_z.
+ * tests/tlog10.c: added bug20230213 test: infinite loop in mpfr_log10,
+ which was occurring before the above bug fix.
+ * tests/tui_pow.c: added testcase for this mpfr_ui_pow_ui bug.
+
+2023-02-14 Vincent Lefevre <vincent@vinc17.net>
+
+ For -dev versions, enable timeout support by default (when possible).
+
+ * configure.ac:
+ - added dev_version variable, set to 1 for -dev versions;
+ - updated --enable-tests-timeout handling;
+ - use $dev_version for a test that already considers -dev versions.
+ * acinclude.m4:
+ - handle absent --enable-tests-timeout option and case "yes".
+
+2023-02-03 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] Added a comment about a failure with glibc 2.37.
+
+ Klaus Dittrich reported in the MPFR mailing-list that the modified
+ test from commit 4f03d40b5a5ceeb3126dc51c3511bdceef3bab19 was still
+ failing with the glibc git. But this time, this is entirely a bug
+ in glibc, present in glibc 2.37:
+
+ https://sourceware.org/bugzilla/show_bug.cgi?id=30068
+
+ with even a possible buffer overflow in sprintf (as I guessed
+ in Comment 2 and was confirmed later). → CVE-2023-25139
+
+ Thus the test still fails with glibc 2.37, and the future fix of
+ the glibc vulnerability should also fix this failure.
+
+2023-02-01 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/{tfprintf.c,tprintf.c}] Fix when decimal_point > 1 byte.
+
+ These tests were failing in locales where localeconv()->decimal_point
+ takes several bytes, such as in the ps_AF locale under Linux, where
+ decimal_point is U+066B ARABIC DECIMAL SEPARATOR, which takes 2 bytes
+ (d9 ab, as encoded in UTF-8).
+
+ Note: A multibyte decimal-point is currently honored only with
+ native C types (via the C library), so that the length of the
+ decimal-point had to be taken into account only for a small number
+ of tests. Once a multibyte decimal-point is supported for the MPFR
+ numbers ("R" type specifier), the expected lengths in many tests
+ will have to be updated. See the code about MPFR_DECIMAL_POINT in
+ "src/mpfr-impl.h".
+
+2023-02-01 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests] Consistency in the error messages.
+
+2023-02-01 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/mpfr-impl.h] Updated FIXME comment for decimal_point/thousands_sep.
+
+ * Added info for the fr_FR.UTF-8 and ps_AF locales.
+ * Removed the sentence about the C standard (since multibyte characters
+ are used for decimal_point and thousands_sep in practice, the term
+ "character" could have a broader mean, e.g. the abstract one in 3.7).
+
+ This completes commit 00ad47c8ec4ba31ad0afd067286f2fab8d7283ff.
+
+2023-01-11 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] Modified a buggy test of the thousands separator.
+
+ The test
+
+ check_vsprintf ("+01,234,567 :", "%0+ -'13.10Pd:", (mpfr_prec_t) 1234567);
+
+ is based on the output from glibc up to 2.36, which is incorrect:
+
+ https://sourceware.org/bugzilla/show_bug.cgi?id=23432
+
+ The GNU C Library has apparently been partially fixed in its Git
+ repository for the future 2.37, since a tsprintf failure has been
+ reported (this is a bug in this test, not in the MPFR library):
+
+ https://sympa.inria.fr/sympa/arc/mpfr/2023-01/msg00001.html
+
+ So, modified the test to avoid the particular case of leading zeros
+ due to the precision field larger than the number of digits. This
+ case has already been tested without the thousands separator (where
+ there are no issues with the C libraries), so that we do not miss
+ much testing. Added a comment explaining the issue and a possible
+ solution for future testing of this particular case (if need be).
+
2023-01-06 Vincent Lefevre <vincent@vinc17.net>
+ [BUGS] Added a note for a bug that cannot occur in practice.
+
+ [doc/README.dev] Updated "To make a release".
+
+ ChangeLog update with tools/update-changelog
+
Updated version to 4.2.0.
2023-01-05 Vincent Lefevre <vincent@vinc17.net>
diff --git a/Build/source/libs/mpfr/mpfr-src/INSTALL b/Build/source/libs/mpfr/mpfr-src/INSTALL
index 64e5e5784ba..a483f78c9e5 100644
--- a/Build/source/libs/mpfr/mpfr-src/INSTALL
+++ b/Build/source/libs/mpfr/mpfr-src/INSTALL
@@ -42,17 +42,17 @@ MPFR).
not been done yet and if patches are available. You can check
on the release page:
- https://www.mpfr.org/mpfr-4.2.0/
+ https://www.mpfr.org/mpfr-4.2.1/
which may have additional information. The patches can be applied
with commands like:
- wget --no-config https://www.mpfr.org/mpfr-4.2.0/allpatches
+ wget --no-config https://www.mpfr.org/mpfr-4.2.1/allpatches
patch -N -Z -p1 < allpatches
or
- curl https://www.mpfr.org/mpfr-4.2.0/allpatches | patch -N -Z -p1
+ curl https://www.mpfr.org/mpfr-4.2.1/allpatches | patch -N -Z -p1
(Those instructions are for the GNU patch command, for example
/usr/bin/gpatch on Solaris.)
@@ -392,7 +392,7 @@ Several documents may help you to solve the problem:
* the FAQ (either the FAQ.html file distributed with MPFR, or the
on-line version <https://www.mpfr.org/faq.html>, which may be more
up-to-date);
- * the MPFR web page for this version <https://www.mpfr.org/mpfr-4.2.0/>,
+ * the MPFR web page for this version <https://www.mpfr.org/mpfr-4.2.1/>,
which lists bugs found in this version and provides some patches.
If the "configure" fails, please check that the C compiler and its
diff --git a/Build/source/libs/mpfr/mpfr-src/NEWS b/Build/source/libs/mpfr/mpfr-src/NEWS
index 95208dcc43e..c11ce0148d8 100644
--- a/Build/source/libs/mpfr/mpfr-src/NEWS
+++ b/Build/source/libs/mpfr/mpfr-src/NEWS
@@ -20,6 +20,14 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
##############################################################################
+Changes from version 4.2.0 to version 4.2.1:
+- Bug fixes (see <https://www.mpfr.org/mpfr-4.2.0/#fixed> and/or the
+ ChangeLog file).
+- Improved MPFR manual.
+- Configure tests: replaced the test of the link with GMP, in order to
+ avoid the use of a function without a prototype (Autoconf issue), as
+ this is obsolescent in ISO C. The new test should be more robust.
+
Changes from versions 4.1.* to version 4.2.0:
- The "fondue savoyarde" release.
- Binary compatible with MPFR 4.0.* and 4.1.*, though some minor changes in
diff --git a/Build/source/libs/mpfr/mpfr-src/VERSION b/Build/source/libs/mpfr/mpfr-src/VERSION
index 6aba2b245a8..fae6e3d04b2 100644
--- a/Build/source/libs/mpfr/mpfr-src/VERSION
+++ b/Build/source/libs/mpfr/mpfr-src/VERSION
@@ -1 +1 @@
-4.2.0
+4.2.1
diff --git a/Build/source/libs/mpfr/mpfr-src/acinclude.m4 b/Build/source/libs/mpfr/mpfr-src/acinclude.m4
index 130e12a597f..d5b5b4bdb98 100644
--- a/Build/source/libs/mpfr/mpfr-src/acinclude.m4
+++ b/Build/source/libs/mpfr/mpfr-src/acinclude.m4
@@ -870,6 +870,32 @@ int main (void) {
])
fi
+dnl Timeout support in the testsuite.
+dnl If the --enable-tests-timeout option has not been provided, let's
+dnl enable timeout support only in -dev versions and if we detect that
+dnl the needed POSIX features seem to be available (this is not much
+dnl useful for releases, where an infinite loop is very unlikely).
+dnl When supported, default is 0 (no timeout).
+if test -z "$enable_tests_timeout" && test -n "$dev_version"; then
+AC_MSG_CHECKING(if timeout can be supported)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/resource.h>
+]], [[
+ struct rlimit rlim[1];
+ if (getrlimit (RLIMIT_CPU, rlim))
+ return 1;
+ rlim->rlim_cur = 1;
+ if (setrlimit (RLIMIT_CPU, rlim))
+ return 1;
+]])], [
+ AC_MSG_RESULT(yes)
+ enable_tests_timeout=yes
+],[AC_MSG_RESULT(no)])
+fi
+if test "$enable_tests_timeout" = yes; then
+ AC_DEFINE([MPFR_TESTS_TIMEOUT], 0, [timeout limit])
+fi
+
])
dnl end of MPFR_CONFIGS
@@ -892,7 +918,7 @@ AC_CACHE_CHECK([for GMP library vs header correctness], mpfr_cv_check_gmp, [
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <limits.h>
-#include <gmp.h>
+#include "gmp.h"
]], [[
fprintf (stderr, "GMP_NAIL_BITS = %d\n", (int) GMP_NAIL_BITS);
fprintf (stderr, "GMP_NUMB_BITS = %d\n", (int) GMP_NUMB_BITS);
@@ -953,7 +979,7 @@ AC_REQUIRE([MPFR_CONFIGS])dnl
AC_CACHE_CHECK([for double-to-integer conversion bug], mpfr_cv_dbl_int_bug, [
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
-#include <gmp.h>
+#include "gmp.h"
]], [[
double d;
mp_limb_t u;
@@ -1005,7 +1031,7 @@ dnl undefined function-like macros (which otherwise may be regarded
dnl as valid function calls with AC_COMPILE_IFELSE since prototypes
dnl are not required by the C standard).
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include <gmp.h>
+#include "gmp.h"
/* Make sure that a static assertion is used (not MPFR_ASSERTN). */
#undef MPFR_USE_STATIC_ASSERT
#define MPFR_USE_STATIC_ASSERT 1
@@ -1037,7 +1063,7 @@ dnl undefined function-like macros (which otherwise may be regarded
dnl as valid function calls with AC_COMPILE_IFELSE since prototypes
dnl are not required by the C standard).
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include <gmp.h>
+#include "gmp.h"
/* Make sure that a static assertion is used (not MPFR_ASSERTN). */
#undef MPFR_USE_STATIC_ASSERT
#define MPFR_USE_STATIC_ASSERT 1
@@ -1587,7 +1613,7 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <string.h>
$3
-#include <gmp.h>
+#include "gmp.h"
]], [[
char s[256];
$2 a = 17;
@@ -1635,17 +1661,17 @@ if test "$ac_cv_type_intmax_t" = yes; then
fi
MPFR_FUNC_GMP_PRINTF_SPEC([hhd], [char], [
-#include <gmp.h>
+#include "gmp.h"
],,
[AC_DEFINE([NPRINTF_HH], 1, [printf/gmp_printf cannot use `hh' length modifier])])
MPFR_FUNC_GMP_PRINTF_SPEC([lld], [long long int], [
-#include <gmp.h>
+#include "gmp.h"
],,
[AC_DEFINE([NPRINTF_LL], 1, [printf/gmp_printf cannot read long long int])])
MPFR_FUNC_GMP_PRINTF_SPEC([Lf], [long double], [
-#include <gmp.h>
+#include "gmp.h"
],
[AC_DEFINE([PRINTF_L], 1, [printf/gmp_printf can read long double])],
[AC_DEFINE([NPRINTF_L], 1, [printf/gmp_printf cannot read long double])])
@@ -1656,7 +1682,7 @@ MPFR_FUNC_GMP_PRINTF_SPEC([td], [ptrdiff_t], [
#else
#include <stddef.h>
#endif
-#include <gmp.h>
+#include "gmp.h"
],
[AC_DEFINE([PRINTF_T], 1, [printf/gmp_printf can read ptrdiff_t])],
[AC_DEFINE([NPRINTF_T], 1, [printf/gmp_printf cannot read ptrdiff_t])])
@@ -1673,7 +1699,7 @@ AC_DEFUN([MPFR_CHECK_PRINTF_GROUPFLAG], [
AC_MSG_CHECKING(if gmp_printf supports the ' group flag)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <string.h>
-#include <gmp.h>
+#include "gmp.h"
]], [[
char s[256];
diff --git a/Build/source/libs/mpfr/mpfr-src/configure.ac b/Build/source/libs/mpfr/mpfr-src/configure.ac
index 49d559f302a..0da51061933 100644
--- a/Build/source/libs/mpfr/mpfr-src/configure.ac
+++ b/Build/source/libs/mpfr/mpfr-src/configure.ac
@@ -26,7 +26,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
])
dnl Add check-news when it checks for more than 15 lines
-AC_INIT([MPFR],[4.2.0])
+AC_INIT([MPFR],[4.2.1])
dnl AC_CANONICAL_HOST is needed by this configure.ac file.
dnl AC_CANONICAL_TARGET is not explicitly needed, but may be required by
@@ -95,6 +95,11 @@ dnl AC_CONFIG_HEADERS([mpfrconf.h:mpfrconf.in])
unset gmp_lib_path GMP_CFLAGS GMP_CC
+unset dev_version
+if $EGREP -q -e '-dev$' $srcdir/VERSION; then
+ dev_version=1
+fi
+
dnl ********************************************************************
dnl Extra arguments to configure (AC_ARG_WITH and AC_ARG_ENABLE)
@@ -228,6 +233,9 @@ AC_ARG_ENABLE(warnings,
*) AC_MSG_ERROR([bad value for --enable-warnings: yes or no]) ;;
esac])
+dnl For timeout support (in the testsuite), the case "yes" and absent
+dnl --enable-tests-timeout option will be handled in a consistent way
+dnl in MPFR_CONFIGS (see acinclude.m4).
AC_ARG_ENABLE(tests-timeout,
[ --enable-tests-timeout=NUM
[[for developers]] enable timeout for test programs
@@ -236,7 +244,7 @@ AC_ARG_ENABLE(tests-timeout,
overrides NUM (0: no timeout)],
[ case $enableval in
no) ;;
- yes) AC_DEFINE([MPFR_TESTS_TIMEOUT], 0, [timeout limit]) ;;
+ yes) ;;
[[0-9]]|[[0-9]][[0-9]]|[[0-9]][[0-9]][[0-9]]|[[0-9]][[0-9]][[0-9]][[0-9]])
AC_DEFINE_UNQUOTED([MPFR_TESTS_TIMEOUT], $enableval, [timeout limit]) ;;
*) AC_MSG_ERROR([bad value for --enable-tests-timeout]) ;;
@@ -558,9 +566,16 @@ dnl
dnl We need to check whether --disable-new-dtags is supported as alternate
dnl linkers may be used (e.g., with tcc: CC=tcc LD=tcc).
dnl
+dnl [2023-08]
+dnl On Android/Termux, -Wl,--disable-new-dtags is supported by clang, but
+dnl the DT_RPATH directories are stripped away when running the program.
+dnl Moreover, config.guess identifies the host as GNU/Linux (*-*-linux-gnu)
+dnl instead of Android (linux*android*), so that we need to explicitly
+dnl exclude Termux.
+dnl
case $host in
- *-*-linux*)
- if test -n "$LD_LIBRARY_PATH"; then
+ *-*-linux-gnu)
+ if test -n "$LD_LIBRARY_PATH" && test -z "$TERMUX_VERSION"; then
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--disable-new-dtags"
AC_MSG_CHECKING(whether --disable-new-dtags is supported by the linker)
@@ -721,10 +736,25 @@ You probably need to change some of the GMP or MPFR compile options.
See 'config.log' for details (search for GMP_NUMB_BITS).])],
[AC_MSG_RESULT([cannot test])])
+MPFR_CHECK_MP_LIMB_T_VS_LONG
+MPFR_CHECK_MP_LIMB_T_VS_INTMAX
+
+dnl Now we will need the GMP library (not just gmp.h).
+dnl Do not use AC_CHECK_LIB as it is based on a deprecated ISO C feature.
+LIBS="-lgmp $LIBS"
+
dnl Check if we can link with GMP
-AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"],
- [AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared).
-Please read the INSTALL file -- see "In case of problem".])])
+AC_MSG_CHECKING(if we can link with GMP)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include "gmp.h"
+mpz_t m;
+]],[[
+mpz_init (m);
+]])],[AC_MSG_RESULT(yes)],[
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([libgmp not found or uses a different ABI (including static vs shared).
+Please read the INSTALL file -- see "In case of problem".])
+])
dnl Check for corresponding 'gmp.h' and libgmp
AC_MSG_CHECKING(if gmp.h version and libgmp version are the same)
@@ -801,9 +831,6 @@ AC_CHECK_FUNCS([__gmpn_invert_limb])
dnl mpn_rsblsh1_n(rp, up, vp, n) does {rp, n} <- 2 * {vp, n} - {up, n}
AC_CHECK_FUNCS([__gmpn_rsblsh1_n])
-MPFR_CHECK_MP_LIMB_T_VS_LONG
-MPFR_CHECK_MP_LIMB_T_VS_INTMAX
-
else
dnl Setup for mini-gmp
@@ -857,7 +884,7 @@ if test -f confdefs.h; then
done
fi
-if $EGREP -q -e '-dev$' $srcdir/VERSION; then
+if test -n "$dev_version"; then
AC_SUBST([DATAFILES])dnl
DATAFILES=`echo \`$SED -n \
's/^ *data_check *("\(data\/[[^"]]*\)".*/tests\/\1/p' \
diff --git a/Build/source/libs/mpfr/mpfr-src/src/Makefile.am b/Build/source/libs/mpfr/mpfr-src/src/Makefile.am
index ce8efcfb85f..c2196f8104e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/Makefile.am
+++ b/Build/source/libs/mpfr/mpfr-src/src/Makefile.am
@@ -103,7 +103,7 @@ libmpfr_la_LIBADD = @LIBOBJS@
# 4.0.x 6:x:0
# 4.1.x 7:x:1
# 4.2.x 8:x:2
-libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 8:0:2
+libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 8:1:2
GET_PATCHES_SH = $(top_srcdir)/tools/get_patches.sh
PATCHES = $(top_srcdir)/PATCHES
diff --git a/Build/source/libs/mpfr/mpfr-src/src/acos.c b/Build/source/libs/mpfr/mpfr-src/src/acos.c
index ce43a784792..1661283c257 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/acos.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/acos.c
@@ -34,8 +34,8 @@ mpfr_acos (mpfr_ptr acos, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("acos[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("acos[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(acos), mpfr_log_prec, acos, inexact));
/* Singular cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/acosh.c b/Build/source/libs/mpfr/mpfr-src/src/acosh.c
index 21ee49950d6..648bb5b72b3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/acosh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/acosh.c
@@ -34,8 +34,8 @@ mpfr_acosh (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
int comp;
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
/* Deal with special cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/acosu.c b/Build/source/libs/mpfr/mpfr-src/src/acosu.c
index 73b67f5ecdf..3f90c247f4e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/acosu.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/acosu.c
@@ -36,9 +36,9 @@ mpfr_acosu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, u,
+ (("x[%Pd]=%.*Rg u=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, u,
rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
/* Singular cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/add.c b/Build/source/libs/mpfr/mpfr-src/src/add.c
index bd5866ef52f..d3947b7d77c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add.c
@@ -26,10 +26,10 @@ MPFR_HOT_FUNCTION_ATTR int
mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
{
MPFR_LOG_FUNC
- (("b[%Pu]=%.*Rg c[%Pu]=%.*Rg rnd=%d",
+ (("b[%Pd]=%.*Rg c[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (b), mpfr_log_prec, b,
mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
- ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+ ("a[%Pd]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
if (MPFR_ARE_SINGULAR_OR_UBF (b, c))
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/add_d.c b/Build/source/libs/mpfr/mpfr-src/src/add_d.c
index 7adeb5c5350..e245e0eb34e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add_d.c
@@ -32,9 +32,9 @@ mpfr_add_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("b[%Pu]=%.*Rg c=%.20g rnd=%d",
+ (("b[%Pd]=%.*Rg c=%.20g rnd=%d",
mpfr_get_prec(b), mpfr_log_prec, b, c, rnd_mode),
- ("a[%Pu]=%.*Rg inexact=%d",
+ ("a[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (a), mpfr_log_prec, a, inexact));
MPFR_SAVE_EXPO_MARK (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/add_ui.c b/Build/source/libs/mpfr/mpfr-src/src/add_ui.c
index 6fbeed6192b..2060673f73e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add_ui.c
@@ -27,9 +27,9 @@ MPFR_HOT_FUNCTION_ATTR int
mpfr_add_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode)
{
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%lu rnd=%d",
+ (("x[%Pd]=%.*Rg u=%lu rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
+ ("y[%Pd]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
/* (unsigned long) 0 is assumed to be a real 0 (unsigned) */
if (MPFR_UNLIKELY (u == 0))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/agm.c b/Build/source/libs/mpfr/mpfr-src/src/agm.c
index 3239ccca693..14fbe65891d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/agm.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/agm.c
@@ -39,10 +39,10 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("op2[%Pu]=%.*Rg op1[%Pu]=%.*Rg rnd=%d",
+ (("op2[%Pd]=%.*Rg op1[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (op2), mpfr_log_prec, op2,
mpfr_get_prec (op1), mpfr_log_prec, op1, rnd_mode),
- ("r[%Pu]=%.*Rg inexact=%d",
+ ("r[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (r), mpfr_log_prec, r, inexact));
/* Deal with special values */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ai.c b/Build/source/libs/mpfr/mpfr-src/src/ai.c
index aa8e8d91ffa..4d5221d00cb 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ai.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ai.c
@@ -70,8 +70,8 @@ mpfr_ai1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
/* Logging */
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
- ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y) );
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pd]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y) );
/* Save current exponents range */
MPFR_SAVE_EXPO_MARK (expo);
@@ -198,7 +198,7 @@ mpfr_ai1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
/* ZIV loop */
for (;;)
{
- MPFR_LOG_MSG (("Working precision: %Pu\n", wprec));
+ MPFR_LOG_MSG (("Working precision: %Pd\n", wprec));
mpfr_set_prec (ti, wprec);
mpfr_set_prec (tip1, wprec);
mpfr_set_prec (x3, wprec);
@@ -257,8 +257,8 @@ mpfr_ai1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
/* err is the number of bits lost due to the evaluation error */
/* wprec-(prec+1): number of bits lost due to the approximation error */
- MPFR_LOG_MSG (("Roundoff error: %Pu\n", err));
- MPFR_LOG_MSG (("Approxim error: %Pu\n", wprec-prec-1));
+ MPFR_LOG_MSG (("Roundoff error: %Pd\n", err));
+ MPFR_LOG_MSG (("Approxim error: %Pd\n", wprec-prec-1));
if (wprec < err + 1)
correct_bits = 0;
@@ -342,8 +342,8 @@ mpfr_ai2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
/* Logging */
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
- ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pd]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
/* Save current exponents range */
MPFR_SAVE_EXPO_MARK (expo);
@@ -431,7 +431,7 @@ mpfr_ai2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
/* ZIV loop */
for (;;)
{
- MPFR_LOG_MSG (("working precision: %Pu\n", wprec));
+ MPFR_LOG_MSG (("working precision: %Pd\n", wprec));
for (j=0; j<=L; j++)
mpfr_set_prec (z[j], wprec);
@@ -548,8 +548,8 @@ mpfr_ai2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
/* err is the number of bits lost due to the evaluation error */
/* wprec-(prec+1): number of bits lost due to the approximation error */
- MPFR_LOG_MSG (("Roundoff error: %Pu\n", err));
- MPFR_LOG_MSG (("Approxim error: %Pu\n", wprec - prec - 1));
+ MPFR_LOG_MSG (("Roundoff error: %Pd\n", err));
+ MPFR_LOG_MSG (("Approxim error: %Pd\n", wprec - prec - 1));
if (wprec < err+1)
correctBits = 0;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/asin.c b/Build/source/libs/mpfr/mpfr-src/src/asin.c
index 29eae21f775..185625139b8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/asin.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/asin.c
@@ -33,8 +33,8 @@ mpfr_asin (mpfr_ptr asin, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("asin[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (asin), mpfr_log_prec, asin,
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("asin[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (asin), mpfr_log_prec, asin,
inexact));
/* Special cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/asinh.c b/Build/source/libs/mpfr/mpfr-src/src/asinh.c
index 831f3fa7904..4c9fd30d012 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/asinh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/asinh.c
@@ -38,8 +38,8 @@ mpfr_asinh (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/asinu.c b/Build/source/libs/mpfr/mpfr-src/src/asinu.c
index 5c4e968de62..09cb66b1e90 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/asinu.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/asinu.c
@@ -35,9 +35,9 @@ mpfr_asinu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, u,
+ (("x[%Pd]=%.*Rg u=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, u,
rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
/* Singular cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atan.c b/Build/source/libs/mpfr/mpfr-src/src/atan.c
index 4220bcbafb8..29b75cdb57c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/atan.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/atan.c
@@ -298,8 +298,8 @@ mpfr_atan (mpfr_ptr atan, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("atan[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("atan[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (atan), mpfr_log_prec, atan, inexact));
/* Singular cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atan2.c b/Build/source/libs/mpfr/mpfr-src/src/atan2.c
index 469c84333ff..a0bc8c241aa 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/atan2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/atan2.c
@@ -55,10 +55,10 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("y[%Pu]=%.*Rg x[%Pu]=%.*Rg rnd=%d",
+ (("y[%Pd]=%.*Rg x[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (y), mpfr_log_prec, y,
mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("atan[%Pu]=%.*Rg inexact=%d",
+ ("atan[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (dest), mpfr_log_prec, dest, inexact));
/* Special cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atan2u.c b/Build/source/libs/mpfr/mpfr-src/src/atan2u.c
index d5ec829ccb9..d6147428c6d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/atan2u.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/atan2u.c
@@ -171,11 +171,11 @@ mpfr_atan2u (mpfr_ptr z, mpfr_srcptr y, mpfr_srcptr x, unsigned long u,
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("y[%Pu]=%.*Rg x[%Pu]=%.*Rg u=%lu rnd=%d",
+ (("y[%Pd]=%.*Rg x[%Pd]=%.*Rg u=%lu rnd=%d",
mpfr_get_prec(y), mpfr_log_prec, y,
mpfr_get_prec(x), mpfr_log_prec, x,
u, rnd_mode),
- ("z[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (z), mpfr_log_prec, z,
+ ("z[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (z), mpfr_log_prec, z,
inex));
/* Special cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atanh.c b/Build/source/libs/mpfr/mpfr-src/src/atanh.c
index 20cac085b26..b832049cfea 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/atanh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/atanh.c
@@ -110,8 +110,8 @@ mpfr_atanh (mpfr_ptr y, mpfr_srcptr xt, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
/* Special cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atanu.c b/Build/source/libs/mpfr/mpfr-src/src/atanu.c
index 780213c9c5a..d44c573e107 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/atanu.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/atanu.c
@@ -36,9 +36,9 @@ mpfr_atanu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, u,
+ (("x[%Pd]=%.*Rg u=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, u,
rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inex));
/* Singular cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cbrt.c b/Build/source/libs/mpfr/mpfr-src/src/cbrt.c
index 11c8e8f48bd..9de4539a0ea 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cbrt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cbrt.c
@@ -55,8 +55,8 @@ mpfr_cbrt (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
/* special values */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/compound.c b/Build/source/libs/mpfr/mpfr-src/src/compound.c
index 16f3b88d2f3..61fa04f114f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/compound.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/compound.c
@@ -55,16 +55,16 @@ int
mpfr_compound_si (mpfr_ptr y, mpfr_srcptr x, long n, mpfr_rnd_t rnd_mode)
{
int inexact, compared, k, nloop;
- mpfr_t t;
- mpfr_exp_t e;
- mpfr_prec_t prec;
+ mpfr_t t, u;
+ mpfr_prec_t py, prec, extra;
+ mpfr_rnd_t rnd1;
MPFR_ZIV_DECL (loop);
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg n=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg n=%ld rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, n, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inexact));
/* Special cases */
if (MPFR_IS_SINGULAR (x))
@@ -136,64 +136,181 @@ mpfr_compound_si (mpfr_ptr y, mpfr_srcptr x, long n, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_MARK (expo);
- prec = MPFR_PREC(y);
- prec += MPFR_INT_CEIL_LOG2 (prec) + 6;
+ py = MPFR_GET_PREC (y);
+ prec = py + MPFR_INT_CEIL_LOG2 (py) + 6;
mpfr_init2 (t, prec);
+ mpfr_init2 (u, prec);
k = MPFR_INT_CEIL_LOG2(SAFE_ABS (unsigned long, n)); /* thus |n| <= 2^k */
+ /* We compute u=log2p1(x) with prec+extra bits, since we lose some bits
+ in 2^u. */
+ extra = 0;
+ rnd1 = VSIGN (n) == MPFR_SIGN (x) ? MPFR_RNDD : MPFR_RNDU;
+
MPFR_ZIV_INIT (loop, prec);
for (nloop = 0; ; nloop++)
{
- /* we compute (1+x)^n as 2^(n*log2p1(x)) */
- inexact = mpfr_log2p1 (t, x, MPFR_RNDN) != 0;
- e = MPFR_GET_EXP(t);
- /* |t - log2(1+x)| <= 1/2*ulp(t) = 2^(e-prec-1) */
- inexact |= mpfr_mul_si (t, t, n, MPFR_RNDN) != 0;
- /* |t - n*log2(1+x)| <= 2^(e2-prec-1) + |n|*2^(e-prec-1)
- <= 2^(e2-prec-1) + 2^(e+k-prec-1) <= 2^(e+k-prec)
- where |n| <= 2^k, and e2 is the new exponent of t. */
- MPFR_ASSERTD(MPFR_GET_EXP(t) <= e + k);
- e += k;
- /* |t - n*log2(1+x)| <= 2^(e-prec) */
- /* detect overflow */
- if (nloop == 0 && mpfr_cmp_si (t, __gmpfr_emax) >= 0)
+ unsigned int inex;
+ mpfr_exp_t e, e2, ex;
+ mpfr_prec_t precu = MPFR_ADD_PREC (prec, extra);
+ mpfr_prec_t new_extra;
+ mpfr_rnd_t rnd2;
+
+ /* We compute (1+x)^n as 2^(n*log2p1(x)),
+ and we round toward 1, thus we round n*log2p1(x) toward 0,
+ thus for x*n > 0 we round log2p1(x) toward -Inf, and for x*n < 0
+ we round log2p1(x) toward +Inf. */
+ inex = mpfr_log2p1 (u, x, rnd1) != 0;
+ e = MPFR_GET_EXP (u);
+ /* |u - log2(1+x)| <= ulp(t) = 2^(e-precu) */
+ inex |= mpfr_mul_si (u, u, n, MPFR_RNDZ) != 0;
+ e2 = MPFR_GET_EXP (u);
+ /* |u - n*log2(1+x)| <= 2^(e2-precu) + |n|*2^(e-precu)
+ <= 2^(e2-precu) + 2^(e+k-precu) <= 2^(e+k+1-precu)
+ where |n| <= 2^k, and e2 is the new exponent of u. */
+ MPFR_ASSERTD (e2 <= e + k);
+ e += k + 1;
+ MPFR_ASSERTN (e2 <= MPFR_PREC_MAX);
+ new_extra = e2 > 0 ? e2 : 0;
+ /* |u - n*log2(1+x)| <= 2^(e-precu) */
+ /* detect overflow: since we rounded n*log2p1(x) toward 0,
+ if n*log2p1(x) >= __gmpfr_emax, we are sure there is overflow. */
+ if (mpfr_cmp_si (u, __gmpfr_emax) >= 0)
{
MPFR_ZIV_FREE (loop);
mpfr_clear (t);
+ mpfr_clear (u);
MPFR_SAVE_EXPO_FREE (expo);
return mpfr_overflow (y, rnd_mode, 1);
}
- /* detect underflow */
- if (nloop == 0 && mpfr_cmp_si (t, __gmpfr_emin - 1) <= 0)
+ /* detect underflow: similarly, since we rounded n*log2p1(x) toward 0,
+ if n*log2p1(x) < __gmpfr_emin-1, we are sure there is underflow. */
+ if (mpfr_cmp_si (u, __gmpfr_emin - 1) < 0)
{
MPFR_ZIV_FREE (loop);
mpfr_clear (t);
+ mpfr_clear (u);
MPFR_SAVE_EXPO_FREE (expo);
return mpfr_underflow (y,
- (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ : rnd_mode, 1);
+ rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode, 1);
}
/* Detect cases where result is 1 or 1+ulp(1) or 1-1/2*ulp(1):
- |2^t - 1| = |exp(t*log(2)) - 1| <= |t|*log(2) < |t| */
- if (nloop == 0 && MPFR_GET_EXP(t) < - (mpfr_exp_t) MPFR_PREC(y))
+ |2^u - 1| = |exp(u*log(2)) - 1| <= |u|*log(2) < |u| */
+ if (nloop == 0 && MPFR_GET_EXP(u) < - py)
{
- /* since ulp(1) = 2^(1-PREC(y)), we have |t| < 1/4*ulp(1) */
+ /* since ulp(1) = 2^(1-py), we have |u| < 1/4*ulp(1) */
/* mpfr_compound_near_one must be called in the extended
exponent range, so that 1 is representable. */
- inexact = mpfr_compound_near_one (y, MPFR_SIGN (t), rnd_mode);
+ inexact = mpfr_compound_near_one (y, MPFR_SIGN (u), rnd_mode);
goto end;
}
- inexact |= mpfr_exp2 (t, t, MPFR_RNDA) != 0;
- /* |t - (1+x)^n| <= ulp(t) + |t|*log(2)*2^(e-prec)
- < 2^(EXP(t)-prec) + 2^(EXP(t)+e-prec) */
- e = (e >= 0) ? e + 1 : 1;
+ /* round 2^u toward 1 */
+ rnd2 = MPFR_IS_POS (u) ? MPFR_RNDD : MPFR_RNDU;
+ inex |= mpfr_exp2 (t, u, rnd2) != 0;
+ /* we had |u - n*log2(1+x)| < 2^(e-precu)
+ thus u = n*log2(1+x) + delta with |delta| < 2^(e-precu)
+ then 2^u = (1+x)^n * 2^delta with |delta| < 2^(e-precu).
+ For |delta| < 0.5, |2^delta - 1| <= |delta| thus
+ |t - (1+x)^n| <= ulp(t) + |t|*2^(e-precu)
+ < 2^(EXP(t)-prec) + 2^(EXP(t)+e-precu) */
+ e = (precu - prec >= e) ? 1 : e + 1 - (precu - prec);
/* now |t - (1+x)^n| < 2^(EXP(t)+e-prec) */
- if (MPFR_LIKELY (inexact == 0 ||
- MPFR_CAN_ROUND (t, prec - e, MPFR_PREC(y), rnd_mode)))
+ if (MPFR_LIKELY (!inex || MPFR_CAN_ROUND (t, prec - e, py, rnd_mode)))
break;
+ /* If t fits in the target precision (or with 1 more bit), then we can
+ round, assuming the working precision is large enough, but the above
+ MPFR_CAN_ROUND() will fail because we cannot determine the ternary
+ value. However since we rounded t toward 1, we can determine it.
+ Since the error in the approximation t is at most 2^e ulp(t),
+ this error should be less than 1/2 ulp(y), thus we should have
+ prec - py >= e + 1. */
+ if (mpfr_min_prec (t) <= py + 1 && prec - py >= e + 1)
+ {
+ /* we add/subtract one ulp to get the correct rounding */
+ if (rnd2 == MPFR_RNDD) /* t was rounded downwards */
+ mpfr_nextabove (t);
+ else
+ mpfr_nextbelow (t);
+ break;
+ }
+
+ /* Detect particular cases where Ziv's strategy may take too much
+ memory and be too long, i.e. when x^n fits in the target precision
+ (+ 1 additional bit for rounding to nearest) and the exact result
+ (1+x)^n is very close to x^n.
+ Necessarily, x is a large even integer and n > 0 (thus n > 1).
+ Since this does not depend on the working precision, we only
+ check this at the first iteration (nloop == 0).
+ Hence the first "if" below and the kx < ex test of the second "if"
+ (x is an even integer iff its least bit 1 has exponent >= 1).
+ The second test of the second "if" corresponds to another simple
+ condition that implies that x^n fits in the target precision.
+ Here are the details:
+ Let k be the minimum length of the significand of x, and x' the odd
+ (integer) significand of x. This means that 2^(k-1) <= x' < 2^k.
+ Thus 2^(n*(k-1)) <= (x')^n < 2^(k*n), and x^n has between n*(k-1)+1
+ and k*n bits. So x^n can fit into p bits only if p >= n*(k-1)+1,
+ i.e. n*(k-1) <= p-1.
+ Note that x >= 2^k, so that x^n >= 2^(k*n). Since raw overflow
+ has already been detected, k*n cannot overflow if computed with
+ the mpfr_exp_t type. Hence the second test of the second "if",
+ which cannot overflow. */
+ MPFR_ASSERTD (n < 0 || n > 1);
+ if (nloop == 0 && n > 1 && (ex = MPFR_GET_EXP (x)) >= 17)
+ {
+ mpfr_prec_t kx = mpfr_min_prec (x);
+ mpfr_prec_t p = py + (rnd_mode == MPFR_RNDN);
+
+ MPFR_LOG_MSG (("Check if x^n fits... n=%ld kx=%Pd p=%Pd\n",
+ n, kx, p));
+ if (kx < ex && n * (mpfr_exp_t) (kx - 1) <= p - 1)
+ {
+ mpfr_t v;
+
+ /* Check whether x^n really fits into p bits. */
+ mpfr_init2 (v, p);
+ inexact = mpfr_pow_ui (v, x, n, MPFR_RNDZ);
+ if (inexact == 0)
+ {
+ MPFR_LOG_MSG (("x^n fits into p bits\n", 0));
+ /* (x+1)^n = x^n * (1 + 1/x)^n
+ For directed rounding, we can round when (1 + 1/x)^n
+ < 1 + 2^-p, and then the result is x^n,
+ except for rounding up. Indeed, if (1 + 1/x)^n < 1 + 2^-p,
+ 1 <= (x+1)^n < x^n * (1 + 2^-p) = x^n + x^n/2^p
+ < x^n + ulp(x^n).
+ For rounding to nearest, we can round when (1 + 1/x)^n
+ < 1 + 2^-p, and then the result is x^n when x^n fits
+ into p-1 bits, and nextabove(x^n) otherwise. */
+ mpfr_ui_div (t, 1, x, MPFR_RNDU);
+ mpfr_add_ui (t, t, 1, MPFR_RNDU);
+ mpfr_pow_ui (t, t, n, MPFR_RNDU);
+ mpfr_sub_ui (t, t, 1, MPFR_RNDU);
+ /* t cannot be zero */
+ if (MPFR_GET_EXP(t) < - py)
+ {
+ mpfr_set (y, v, MPFR_RNDZ);
+ if ((rnd_mode == MPFR_RNDN && mpfr_min_prec (v) == p)
+ || rnd_mode == MPFR_RNDU || rnd_mode == MPFR_RNDA)
+ {
+ /* round up */
+ mpfr_nextabove (y);
+ inexact = 1;
+ }
+ else
+ inexact = -1;
+ mpfr_clear (v);
+ goto end;
+ }
+ }
+ mpfr_clear (v);
+ }
+ }
+
/* Exact cases like compound(0.5,2) = 9/4 must be detected, since
except for 1+x power of 2, the log2p1 above will be inexact,
so that in the Ziv test, inexact != 0 and MPFR_CAN_ROUND will
@@ -211,6 +328,8 @@ mpfr_compound_si (mpfr_ptr y, mpfr_srcptr x, long n, mpfr_rnd_t rnd_mode)
MPFR_ZIV_NEXT (loop, prec);
mpfr_set_prec (t, prec);
+ extra = new_extra;
+ mpfr_set_prec (u, MPFR_ADD_PREC (prec, extra));
}
inexact = mpfr_set (y, t, rnd_mode);
@@ -218,6 +337,7 @@ mpfr_compound_si (mpfr_ptr y, mpfr_srcptr x, long n, mpfr_rnd_t rnd_mode)
end:
MPFR_ZIV_FREE (loop);
mpfr_clear (t);
+ mpfr_clear (u);
MPFR_SAVE_EXPO_FREE (expo);
return mpfr_check_range (y, inexact, rnd_mode);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c b/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c
index 2c748c933c8..c8738660366 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c
@@ -92,7 +92,7 @@ mpfr_const_catalan_internal (mpfr_ptr g, mpfr_rnd_t rnd_mode)
MPFR_GROUP_DECL (group);
MPFR_LOG_FUNC (("rnd_mode=%d", rnd_mode),
- ("g[%Pu]=%.*Rg inex=%d", mpfr_get_prec (g), mpfr_log_prec, g, inex));
+ ("g[%Pd]=%.*Rg inex=%d", mpfr_get_prec (g), mpfr_log_prec, g, inex));
/* Here are the WC (max prec = 100.000.000)
Once we have found a chain of 11, we only look for bigger chain.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/const_log2.c b/Build/source/libs/mpfr/mpfr-src/src/const_log2.c
index 7e29e40faff..64d7a43c3cd 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/const_log2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/const_log2.c
@@ -121,7 +121,7 @@ mpfr_const_log2_internal (mpfr_ptr x, mpfr_rnd_t rnd_mode)
MPFR_LOG_FUNC (
("rnd_mode=%d", rnd_mode),
- ("x[%Pu]=%.*Rg inex=%d", mpfr_get_prec(x), mpfr_log_prec, x, inexact));
+ ("x[%Pd]=%.*Rg inex=%d", mpfr_get_prec(x), mpfr_log_prec, x, inexact));
w = n + MPFR_INT_CEIL_LOG2 (n) + 3;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/const_pi.c b/Build/source/libs/mpfr/mpfr-src/src/const_pi.c
index e72e2e11e42..a1627a45a02 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/const_pi.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/const_pi.c
@@ -55,7 +55,7 @@ mpfr_const_pi_internal (mpfr_ptr x, mpfr_rnd_t rnd_mode)
MPFR_LOG_FUNC
(("rnd_mode=%d", rnd_mode),
- ("x[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(x), mpfr_log_prec, x, inex));
+ ("x[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(x), mpfr_log_prec, x, inex));
px = MPFR_PREC (x);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cos.c b/Build/source/libs/mpfr/mpfr-src/src/cos.c
index b6403687330..308242b72b9 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cos.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cos.c
@@ -141,8 +141,8 @@ mpfr_cos (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_GROUP_DECL (group);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cosh.c b/Build/source/libs/mpfr/mpfr-src/src/cosh.c
index 9341b170ba7..c5dbc33a4fe 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cosh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cosh.c
@@ -34,8 +34,8 @@ mpfr_cosh (mpfr_ptr y, mpfr_srcptr xt, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(xt)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cosu.c b/Build/source/libs/mpfr/mpfr-src/src/cosu.c
index 97ecfaa7570..b318e7680d3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cosu.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cosu.c
@@ -37,9 +37,9 @@ mpfr_cosu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg u=%lu rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, u,
+ ("x[%Pd]=%.*Rg u=%lu rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, u,
rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (u == 0 || MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/d_div.c b/Build/source/libs/mpfr/mpfr-src/src/d_div.c
index 9a0600ccb39..9afa7e2dd26 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/d_div.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/d_div.c
@@ -32,8 +32,8 @@ mpfr_d_div (mpfr_ptr a, double b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("b=%.20g c[%Pu]=%.*Rg rnd=%d", b, mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
- ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+ ("b=%.20g c[%Pd]=%.*Rg rnd=%d", b, mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
+ ("a[%Pd]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
MPFR_SAVE_EXPO_MARK (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/d_sub.c b/Build/source/libs/mpfr/mpfr-src/src/d_sub.c
index 4496ab907cd..41e3309378f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/d_sub.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/d_sub.c
@@ -32,8 +32,8 @@ mpfr_d_sub (mpfr_ptr a, double b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("b=%.20g c[%Pu]=%.*Rg rnd=%d", b, mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
- ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+ ("b=%.20g c[%Pd]=%.*Rg rnd=%d", b, mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
+ ("a[%Pd]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
MPFR_SAVE_EXPO_MARK (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/digamma.c b/Build/source/libs/mpfr/mpfr-src/src/digamma.c
index 6cb7ec8d864..92c604be41e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/digamma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/digamma.c
@@ -122,8 +122,8 @@ mpfr_digamma_reflection (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex));
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex));
/* we want that 1-x is exact with precision q: if 0 < x < 1/2, then
q = PREC(x)-EXP(x) is ok, otherwise if -1 <= x < 0, q = PREC(x)-EXP(x)
@@ -214,8 +214,8 @@ mpfr_digamma_positive (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex));
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex));
/* For very large x, use |digamma(x) - log(x)| < 1/x < 2^(1-EXP(x)).
However, for a fixed value of GUARD, MPFR_CAN_ROUND() might fail
@@ -259,7 +259,7 @@ mpfr_digamma_positive (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
q = MPFR_PREC(x) + 1;
/* FIXME: q can be much too large, e.g. equal to the maximum exponent! */
- MPFR_LOG_MSG (("q=%Pu\n", q));
+ MPFR_LOG_MSG (("q=%Pd\n", q));
mpfr_init2 (x_plus_j, q);
@@ -338,8 +338,8 @@ mpfr_digamma (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex));
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inex));
if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/div.c b/Build/source/libs/mpfr/mpfr-src/src/div.c
index 28426c483e9..3f90fac3245 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div.c
@@ -770,10 +770,10 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode)
MPFR_TMP_DECL(marker);
MPFR_LOG_FUNC (
- ("u[%Pu]=%.*Rg v[%Pu]=%.*Rg rnd=%d",
+ ("u[%Pd]=%.*Rg v[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec(u), mpfr_log_prec, u,
mpfr_get_prec (v),mpfr_log_prec, v, rnd_mode),
- ("q[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(q), mpfr_log_prec, q, inex));
+ ("q[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(q), mpfr_log_prec, q, inex));
/**************************************************************************
* *
diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_2si.c b/Build/source/libs/mpfr/mpfr-src/src/div_2si.c
index ae584a409a5..a31e066ae3c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_2si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_2si.c
@@ -28,9 +28,9 @@ mpfr_div_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode)
int inexact;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg n=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg n=%ld rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, n, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c b/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c
index 7dac999b09f..112995048f9 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c
@@ -28,9 +28,9 @@ mpfr_div_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long n, mpfr_rnd_t rnd_mode)
int inexact;
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg n=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, n,
+ ("x[%Pd]=%.*Rg n=%lu rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, n,
rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inexact));
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY (n == 0 || MPFR_IS_SINGULAR (x)))
return mpfr_set (y, x, rnd_mode);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_d.c b/Build/source/libs/mpfr/mpfr-src/src/div_d.c
index f5fdf9b6789..de84a88fbf8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_d.c
@@ -32,9 +32,9 @@ mpfr_div_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("b[%Pu]=%.*Rg c%.20g rnd=%d", mpfr_get_prec (b), mpfr_log_prec, b, c,
+ ("b[%Pd]=%.*Rg c%.20g rnd=%d", mpfr_get_prec (b), mpfr_log_prec, b, c,
rnd_mode),
- ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+ ("a[%Pd]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
MPFR_SAVE_EXPO_MARK (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_ui.c b/Build/source/libs/mpfr/mpfr-src/src/div_ui.c
index 4e051ea1fc6..85303ac84b7 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_ui.c
@@ -46,9 +46,9 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u,
MPFR_TMP_DECL(marker);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%lu rnd=%d",
+ (("x[%Pd]=%.*Rg u=%lu rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/eint.c b/Build/source/libs/mpfr/mpfr-src/src/eint.c
index f9eb54f29e7..2c35c498eb7 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/eint.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/eint.c
@@ -47,8 +47,8 @@ mpfr_eint_aux (mpfr_ptr y, mpfr_srcptr x)
MPFR_GROUP_DECL (group);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x),
- ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
+ ("x[%Pd]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x),
+ ("y[%Pd]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
/* for |x| <= 1, we have S := sum(x^k/k/k!, k=1..infinity) = x + R(x)
where |R(x)| <= (x/2)^2/(1-|x|/2) <= 2*(x/2)^2
@@ -182,7 +182,7 @@ mpfr_eint_asympt (mpfr_ptr y, mpfr_srcptr x)
mpfr_exp_t err_exp;
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x),
+ ("x[%Pd]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x),
("err_exp=%" MPFR_EXP_FSPEC "d", (mpfr_eexp_t) err_exp));
mpfr_init2 (t, p);
@@ -232,8 +232,8 @@ mpfr_eint (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
+ ("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/erf.c b/Build/source/libs/mpfr/mpfr-src/src/erf.c
index b0d820ed5af..c62cf1dbf3f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/erf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/erf.c
@@ -34,8 +34,8 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/erfc.c b/Build/source/libs/mpfr/mpfr-src/src/erfc.c
index b2db6a9e12a..1dbc2305c93 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/erfc.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/erfc.c
@@ -132,8 +132,8 @@ mpfr_erfc (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y, inex));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exceptions.c b/Build/source/libs/mpfr/mpfr-src/src/exceptions.c
index 800d9936a08..82b224e3c5d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exceptions.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exceptions.c
@@ -384,7 +384,7 @@ mpfr_underflow (mpfr_ptr x, mpfr_rnd_t rnd_mode, int sign)
MPFR_LOG_FUNC
(("rnd=%d sign=%d", rnd_mode, sign),
- ("x[%Pu]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x));
+ ("x[%Pd]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x));
MPFR_ASSERT_SIGN (sign);
@@ -412,7 +412,7 @@ mpfr_overflow (mpfr_ptr x, mpfr_rnd_t rnd_mode, int sign)
MPFR_LOG_FUNC
(("rnd=%d sign=%d", rnd_mode, sign),
- ("x[%Pu]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x));
+ ("x[%Pd]=%.*Rg", mpfr_get_prec (x), mpfr_log_prec, x));
MPFR_ASSERT_SIGN (sign);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp.c b/Build/source/libs/mpfr/mpfr-src/src/exp.c
index de57dcddd72..ff5eea86596 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp.c
@@ -41,8 +41,8 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY( MPFR_IS_SINGULAR(x) ))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp10m1.c b/Build/source/libs/mpfr/mpfr-src/src/exp10m1.c
index 42eb215b3aa..1234621ee7f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp10m1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp10m1.c
@@ -69,8 +69,8 @@ mpfr_exp10m1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_IS_SINGULAR (x))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp2.c b/Build/source/libs/mpfr/mpfr-src/src/exp2.c
index b64546bb339..25aa005dce7 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp2.c
@@ -52,8 +52,8 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp2m1.c b/Build/source/libs/mpfr/mpfr-src/src/exp2m1.c
index 4dc4221bdb4..025df6f142d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp2m1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp2m1.c
@@ -74,8 +74,8 @@ mpfr_exp2m1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_IS_SINGULAR (x))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp3.c b/Build/source/libs/mpfr/mpfr-src/src/exp3.c
index 890d7e900d6..04d5b11c443 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp3.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp3.c
@@ -171,8 +171,8 @@ mpfr_exp_3 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (ziv_loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
inexact));
MPFR_SAVE_EXPO_MARK (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp_2.c b/Build/source/libs/mpfr/mpfr-src/src/exp_2.c
index b59ad02bee4..20393149749 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp_2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp_2.c
@@ -87,8 +87,8 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y,
inexact));
expx = MPFR_GET_EXP (x);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/expm1.c b/Build/source/libs/mpfr/mpfr-src/src/expm1.c
index a8b8d5a5358..ec265416f5b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/expm1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/expm1.c
@@ -35,8 +35,8 @@ mpfr_expm1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fma.c b/Build/source/libs/mpfr/mpfr-src/src/fma.c
index 5ea26addab2..d9c6ded6d3f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fma.c
@@ -109,11 +109,11 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
MPFR_GROUP_DECL(group);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg z[%Pu]=%.*Rg rnd=%d",
+ (("x[%Pd]=%.*Rg y[%Pd]=%.*Rg z[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x,
mpfr_get_prec (y), mpfr_log_prec, y,
mpfr_get_prec (z), mpfr_log_prec, z, rnd_mode),
- ("s[%Pu]=%.*Rg inexact=%d",
+ ("s[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (s), mpfr_log_prec, s, inexact));
/* particular cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fmma.c b/Build/source/libs/mpfr/mpfr-src/src/fmma.c
index f697a9094d2..0d07f205603 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fmma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fmma.c
@@ -36,12 +36,12 @@ mpfr_fmma_aux (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c,
MPFR_TMP_DECL(marker);
MPFR_LOG_FUNC
- (("a[%Pu]=%.*Rg b[%Pu]=%.*Rg c[%Pu]=%.*Rg d[%Pu]=%.*Rg rnd=%d neg=%d",
+ (("a[%Pd]=%.*Rg b[%Pd]=%.*Rg c[%Pd]=%.*Rg d[%Pd]=%.*Rg rnd=%d neg=%d",
mpfr_get_prec (a), mpfr_log_prec, a,
mpfr_get_prec (b), mpfr_log_prec, b,
mpfr_get_prec (c), mpfr_log_prec, c,
mpfr_get_prec (d), mpfr_log_prec, d, rnd, neg),
- ("z[%Pu]=%.*Rg inex=%d",
+ ("z[%Pd]=%.*Rg inex=%d",
mpfr_get_prec (z), mpfr_log_prec, z, inex));
MPFR_TMP_MARK (marker);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c b/Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c
index f1e2fa18371..76984276689 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c
@@ -29,9 +29,9 @@ mpfr_fmod_ui (mpfr_ptr r, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
int inex;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%lu rnd=%d",
+ (("x[%Pd]=%.*Rg u=%lu rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(r), mpfr_log_prec, r, inex));
if (MPFR_UNLIKELY (u != 0))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/frexp.c b/Build/source/libs/mpfr/mpfr-src/src/frexp.c
index e4e8cecd39c..a9ae5f3f732 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/frexp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/frexp.c
@@ -30,8 +30,8 @@ mpfr_frexp (mpfr_exp_t *exp, mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
MPFR_BLOCK_DECL (flags);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
- ("y[%Pu]=%.*Rg exp=%" MPFR_EXP_FSPEC "d inex=%d", mpfr_get_prec (y),
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pd]=%.*Rg exp=%" MPFR_EXP_FSPEC "d inex=%d", mpfr_get_prec (y),
mpfr_log_prec, y, (mpfr_eexp_t) *exp, inex));
if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/gamma.c b/Build/source/libs/mpfr/mpfr-src/src/gamma.c
index f18eb68d338..f8b2bdc487f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/gamma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/gamma.c
@@ -122,8 +122,8 @@ mpfr_gamma (mpfr_ptr gamma, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("gamma[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("gamma[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (gamma), mpfr_log_prec, gamma, inex));
/* Trivial cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_str.c b/Build/source/libs/mpfr/mpfr-src/src/get_str.c
index f62df89e970..af62651b648 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_str.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_str.c
@@ -2605,7 +2605,7 @@ mpfr_get_str (char *s, mpfr_exp_t *e, int b, size_t m, mpfr_srcptr x,
/* otherwise err is such that |x*b^(m-g)-a*2^exp_a| < 2^(err+exp_a) */
MPFR_LOG_FUNC
- (("b=%d m=%zu x[%Pu]=%.*Rg rnd=%d",
+ (("b=%d m=%zu x[%Pd]=%.*Rg rnd=%d",
b, m, mpfr_get_prec (x), mpfr_log_prec, x, rnd),
("flags=%lx", (unsigned long) __gmpfr_flags));
diff --git a/Build/source/libs/mpfr/mpfr-src/src/hypot.c b/Build/source/libs/mpfr/mpfr-src/src/hypot.c
index 0d0ba0aae54..726c0d33208 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/hypot.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/hypot.c
@@ -43,10 +43,10 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
MPFR_BLOCK_DECL (flags);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg rnd=%d",
+ (("x[%Pd]=%.*Rg y[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x,
mpfr_get_prec (y), mpfr_log_prec, y, rnd_mode),
- ("z[%Pu]=%.*Rg inexact=%d",
+ ("z[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (z), mpfr_log_prec, z, inexact));
/* particular cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/inp_str.c b/Build/source/libs/mpfr/mpfr-src/src/inp_str.c
index 32e079fa08f..d34c3ee5f46 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/inp_str.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/inp_str.c
@@ -69,15 +69,25 @@ mpfr_inp_str (mpfr_ptr rop, FILE *stream, int base, mpfr_rnd_t rnd_mode)
if (c == EOF || isspace (c))
break;
str[str_size++] = (unsigned char) c;
+ /* If c is '\0' (while not being a whitespace character), the word will
+ not have a valid format. But in the context of a string in memory,
+ '\0' is a terminating null character. So, to avoid ending with a
+ valid string format (like "1" with ignored characters after the
+ terminating null character), we need to make sure that the string
+ does not have a valid format; so let's start it with '*'. Note
+ that we should read the full word, so we cannot break. */
+ if (MPFR_UNLIKELY (c == '\0'))
+ str[0] = '*';
if (str_size == (size_t) -1)
break;
c = getc (stream);
}
- /* FIXME: The use of ungetc has been deprecated since C99 when it
- occurs at the beginning of a binary stream, and this may happen
- on /dev/null. One could add a "if (c != EOF)" test, but let's
- wait for some discussion in comp.std.c first... */
- ungetc (c, stream);
+ /* The use of ungetc has been deprecated since C99 when it occurs at the
+ beginning of a binary stream, and this may happen on /dev/null. Here,
+ this is possible only for c == EOF. The condition "if (c != EOF)" below
+ is just there to handle this case. */
+ if (c != EOF)
+ ungetc (c, stream);
if (MPFR_UNLIKELY (str_size == (size_t) -1 || str_size == 0 ||
(c == EOF && ! feof (stream))))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/jn.c b/Build/source/libs/mpfr/mpfr-src/src/jn.c
index 5a92f9cee48..459b1042079 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/jn.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/jn.c
@@ -95,8 +95,8 @@ mpfr_jn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("n=%d x[%Pu]=%.*Rg rnd=%d", n, mpfr_get_prec (z), mpfr_log_prec, z, r),
- ("res[%Pu]=%.*Rg inexact=%d",
+ (("n=%d x[%Pd]=%.*Rg rnd=%d", n, mpfr_get_prec (z), mpfr_log_prec, z, r),
+ ("res[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (res), mpfr_log_prec, res, inex));
absn = SAFE_ABS (unsigned long, n);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/li2.c b/Build/source/libs/mpfr/mpfr-src/src/li2.c
index 901894e47b9..91f23283a47 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/li2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/li2.c
@@ -221,8 +221,8 @@ mpfr_li2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/lngamma.c b/Build/source/libs/mpfr/mpfr-src/src/lngamma.c
index b68044a0182..7e89e92a39f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/lngamma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/lngamma.c
@@ -34,8 +34,8 @@ static void
mpfr_gamma_alpha (mpfr_ptr s, mpfr_prec_t p)
{
MPFR_LOG_FUNC
- (("p=%Pu", p),
- ("s[%Pu]=%.*Rg", mpfr_get_prec (s), mpfr_log_prec, s));
+ (("p=%Pd", p),
+ ("s[%Pd]=%.*Rg", mpfr_get_prec (s), mpfr_log_prec, s));
if (p <= 100)
mpfr_set_ui_2exp (s, 614, -10, MPFR_RNDN); /* about 0.6 */
@@ -179,8 +179,8 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (z0), mpfr_log_prec, z0, rnd),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (z0), mpfr_log_prec, z0, rnd),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
compared = mpfr_cmp_ui (z0, 1);
@@ -723,8 +723,8 @@ mpfr_lngamma (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
int inex;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inex));
/* special cases */
@@ -763,8 +763,8 @@ mpfr_lgamma (mpfr_ptr y, int *signp, mpfr_srcptr x, mpfr_rnd_t rnd)
int inex;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
- ("y[%Pu]=%.*Rg signp=%d inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
+ ("y[%Pd]=%.*Rg signp=%d inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, *signp, inex));
*signp = 1; /* most common case */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log.c b/Build/source/libs/mpfr/mpfr-src/src/log.c
index 677fcc3d6e4..8f00167410f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log.c
@@ -50,8 +50,8 @@ mpfr_log (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
MPFR_GROUP_DECL(group);
MPFR_LOG_FUNC
- (("a[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
- ("r[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r,
+ (("a[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
+ ("r[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r,
inexact));
/* Special cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log10.c b/Build/source/libs/mpfr/mpfr-src/src/log10.c
index a045ef155bc..ba2a6b7a0ff 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log10.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log10.c
@@ -35,8 +35,8 @@ mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("a[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
- ("r[%Pu]=%.*Rg inexact=%d",
+ (("a[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
+ ("r[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (r), mpfr_log_prec, r, inexact));
/* If a is NaN, the result is NaN */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log10p1.c b/Build/source/libs/mpfr/mpfr-src/src/log10p1.c
index 01856442c2f..811cece9291 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log10p1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log10p1.c
@@ -129,8 +129,8 @@ mpfr_log10p1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log1p.c b/Build/source/libs/mpfr/mpfr-src/src/log1p.c
index 87f35e07c57..7f26e66d375 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log1p.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log1p.c
@@ -106,8 +106,8 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log2.c b/Build/source/libs/mpfr/mpfr-src/src/log2.c
index 310ec985251..56b3a2f2c2a 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log2.c
@@ -33,8 +33,8 @@ mpfr_log2 (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("a[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
- ("r[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r,
+ (("a[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (a), mpfr_log_prec, a, rnd_mode),
+ ("r[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (a)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log2p1.c b/Build/source/libs/mpfr/mpfr-src/src/log2p1.c
index ac0bdd6170d..20a9c663f63 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log2p1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log2p1.c
@@ -89,8 +89,8 @@ mpfr_log2p1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/modf.c b/Build/source/libs/mpfr/mpfr-src/src/modf.c
index 5f1377bb32f..fc4f6a0e35a 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/modf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/modf.c
@@ -31,9 +31,9 @@ mpfr_modf (mpfr_ptr iop, mpfr_ptr fop, mpfr_srcptr op, mpfr_rnd_t rnd_mode)
int inexi, inexf;
MPFR_LOG_FUNC
- (("op[%Pu]=%.*Rg rnd=%d",
+ (("op[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (op), mpfr_log_prec, op, rnd_mode),
- ("iop[%Pu]=%.*Rg fop[%Pu]=%.*Rg",
+ ("iop[%Pd]=%.*Rg fop[%Pd]=%.*Rg",
mpfr_get_prec (iop), mpfr_log_prec, iop,
mpfr_get_prec (fop), mpfr_log_prec, fop));
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h
index 098fd956f44..4cae6254860 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h
@@ -468,14 +468,22 @@ void *alloca (size_t);
and outputs may overlap.
*/
#ifndef udiv_qr_3by2
-#define udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv) \
+# ifdef MPFR_USE_MINI_GMP
+/* Avoid integer overflow on int in case of integer promotion
+ (when mp_limb_t is shorter than int). Note that unsigned long
+ may be longer than necessary, but GCC seems to optimize. */
+# define OP_CAST (unsigned long)
+# else
+# define OP_CAST
+# endif
+# define udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv) \
do { \
mp_limb_t _q0, _t1, _t0, _mask; \
umul_ppmm ((q), _q0, (n2), (dinv)); \
add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1)); \
\
/* Compute the two most significant limbs of n - q'd */ \
- (r1) = (n1) - (d1) * (q); \
+ (r1) = (n1) - OP_CAST (d1) * (q); \
(r0) = (n0); \
sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \
umul_ppmm (_t1, _t0, (d0), (q)); \
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h
index fe54cecab26..5019ca68bc1 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h
@@ -1655,8 +1655,10 @@ do { \
this can be found in practice: https://reviews.llvm.org/D27167 says:
"I found this problem on FreeBSD 11, where thousands_sep in fr_FR.UTF-8
is a no-break space (U+00A0)."
- Note, however, that this is not allowed by the C standard, which just
- says "character" and not "multibyte character".
+ Under Linux, this is U+202F NARROW NO-BREAK SPACE (e2 80 af).
+ And in the ps_AF locale,
+ decimal_point = U+066B ARABIC DECIMAL SEPARATOR (d9 ab)
+ thousands_sep = U+066C ARABIC THOUSANDS SEPARATOR (d9 ac)
In the mean time, in case of non-single-byte character, revert to the
default value. */
#if MPFR_LCONV_DPTS
@@ -2192,7 +2194,7 @@ __MPFR_DECLSPEC extern mpfr_prec_t mpfr_log_prec;
while (0)
#define MPFR_LOG_VAR(x) \
- LOG_PRINT (MPFR_LOG_INTERNAL_F, "%s.%d:%s[%#Pu]=%.*Rg\n", __func__, \
+ LOG_PRINT (MPFR_LOG_INTERNAL_F, "%s.%d:%s[%#Pd]=%.*Rg\n", __func__, \
(int) __LINE__, #x, mpfr_get_prec (x), mpfr_log_prec, x)
#define MPFR_LOG_MSG2(format, ...) \
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h
index a3099b0d937..344f1e43bf5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h
@@ -64,10 +64,13 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define MPFR_LOCK_DECL(_lock) \
mtx_t _lock;
-#define MPFR_LOCK_C(E) \
- do { \
- if ((E) != thrd_success) \
- abort (); \
+#define MPFR_LOCK_C(E) \
+ do { \
+ if ((E) != thrd_success) \
+ { \
+ fprintf (stderr, "MPFR lock failure\n"); \
+ abort (); \
+ } \
} while (0)
#define MPFR_LOCK_INIT(_lock) MPFR_LOCK_C(mtx_init(&(_lock), mtx_plain))
@@ -107,10 +110,13 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define MPFR_LOCK_DECL(_lock) \
pthread_rwlock_t _lock;
-#define MPFR_LOCK_C(E) \
- do { \
- if ((E) != 0) \
- abort (); \
+#define MPFR_LOCK_C(E) \
+ do { \
+ if ((E) != 0) \
+ { \
+ fprintf (stderr, "MPFR lock failure\n"); \
+ abort (); \
+ } \
} while (0)
#define MPFR_LOCK_INIT(_lock) MPFR_LOCK_C(pthread_rwlock_init(&(_lock), NULL))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
index 4610c67bb17..6322670c440 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
@@ -26,8 +26,8 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* Define MPFR version number */
#define MPFR_VERSION_MAJOR 4
#define MPFR_VERSION_MINOR 2
-#define MPFR_VERSION_PATCHLEVEL 0
-#define MPFR_VERSION_STRING "4.2.0"
+#define MPFR_VERSION_PATCHLEVEL 1
+#define MPFR_VERSION_STRING "4.2.1"
/* User macros:
MPFR_USE_FILE: Define it to make MPFR define functions dealing
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul.c b/Build/source/libs/mpfr/mpfr-src/src/mul.c
index 6f319040b03..fef4a880038 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul.c
@@ -740,10 +740,10 @@ mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
MPFR_TMP_DECL (marker);
MPFR_LOG_FUNC
- (("b[%Pu]=%.*Rg c[%Pu]=%.*Rg rnd=%d",
+ (("b[%Pd]=%.*Rg c[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (b), mpfr_log_prec, b,
mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
- ("a[%Pu]=%.*Rg inexact=%d",
+ ("a[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (a), mpfr_log_prec, a, inexact));
/* deal with special cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c b/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c
index 7d0038c74a3..eb322f480d1 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c
@@ -28,9 +28,9 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode)
int inexact;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg n=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg n=%ld rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, n, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c b/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c
index b76f8579708..8cf64fd640e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c
@@ -28,9 +28,9 @@ mpfr_mul_2ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd_mod
int inexact;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg n=%lu rnd=%d",
+ (("x[%Pd]=%.*Rg n=%lu rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, n, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
inexact = (y != x) ? mpfr_set (y, x, rnd_mode) : 0;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_d.c b/Build/source/libs/mpfr/mpfr-src/src/mul_d.c
index e0fe1e7e981..257a4390929 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_d.c
@@ -32,9 +32,9 @@ mpfr_mul_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("b[%Pu]=%.*Rg c=%.20g rnd=%d",
+ (("b[%Pd]=%.*Rg c=%.20g rnd=%d",
mpfr_get_prec(b), mpfr_log_prec, b, c, rnd_mode),
- ("a[%Pu]=%.*Rg inexact=%d",
+ ("a[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (a), mpfr_log_prec, a, inexact));
MPFR_SAVE_EXPO_MARK (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow.c b/Build/source/libs/mpfr/mpfr-src/src/pow.c
index a7ba3ee1ff3..302e5635cd0 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pow.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow.c
@@ -64,7 +64,7 @@ mpfr_pow_is_exact (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
MPFR_ASSERTD (d < 0);
/* Compute a,b such that x=a*2^b.
- Since a comes from a regular MPFR number, due to the constrainst on the
+ Since a comes from a regular MPFR number, due to the constraints on the
exponent and the precision, there can be no integer overflow below. */
mpz_init (a);
b = mpfr_get_z_2exp (a, x);
@@ -131,14 +131,13 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
/* Declaration of the size variable */
mpfr_prec_t Nz = MPFR_PREC(z); /* target precision */
mpfr_prec_t Nt; /* working precision */
- mpfr_exp_t err; /* error */
MPFR_ZIV_DECL (ziv_loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg rnd=%d",
+ (("x[%Pd]=%.*Rg y[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x,
mpfr_get_prec (y), mpfr_log_prec, y, rnd_mode),
- ("z[%Pu]=%.*Rg inexact=%d",
+ ("z[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (z), mpfr_log_prec, z, inexact));
/* We put the absolute value of x in absx, pointing to the significand
@@ -171,12 +170,14 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
MPFR_ZIV_INIT (ziv_loop, Nt);
for (;;)
{
+ mpfr_exp_t err, exp_t;
MPFR_BLOCK_DECL (flags1);
/* compute exp(y*ln|x|), using MPFR_RNDU to get an upper bound, so
that we can detect underflows. */
mpfr_log (t, absx, MPFR_IS_NEG (y) ? MPFR_RNDD : MPFR_RNDU); /* ln|x| */
mpfr_mul (t, y, t, MPFR_RNDU); /* y*ln|x| */
+ exp_t = MPFR_GET_EXP (t);
if (k_non_zero)
{
MPFR_LOG_MSG (("subtract k * ln(2)\n", 0));
@@ -188,14 +189,16 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
MPFR_LOG_VAR (t);
}
/* estimate of the error -- see pow function in algorithms.tex.
- The error on t is at most 1/2 + 3*2^(EXP(t)+1) ulps, which is
- <= 2^(EXP(t)+3) for EXP(t) >= -1, and <= 2 ulps for EXP(t) <= -2.
+ The error on t before the subtraction of k*log(2) is at most
+ 1/2 + 3*2^(EXP(t)+1) ulps, which is <= 2^(EXP(t)+3) for EXP(t) >= -1,
+ and <= 2 ulps for EXP(t) <= -2.
Additional error if k_no_zero: treal = t * errk, with
1 - |k| * 2^(-Nt) <= exp(-|k| * 2^(-Nt)) <= errk <= 1,
i.e., additional absolute error <= 2^(EXP(k)+EXP(t)-Nt).
- Total error <= 2^err1 + 2^err2 <= 2^(max(err1,err2)+1). */
- err = MPFR_NOTZERO (t) && MPFR_GET_EXP (t) >= -1 ?
- MPFR_GET_EXP (t) + 3 : 1;
+ Total ulp error <= 2^err1 + 2^err2 <= 2^(max(err1,err2)+1),
+ where err1 = EXP(t)+3 for EXP(t) >= -1, and 1 otherwise,
+ and err2 = EXP(k). */
+ err = MPFR_NOTZERO (t) && exp_t >= -1 ? exp_t + 3 : 1;
if (k_non_zero)
{
if (MPFR_GET_EXP (k) > err)
@@ -328,11 +331,17 @@ mpfr_pow_general (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y,
*/
if (rnd_mode == MPFR_RNDN && inexact < 0 && lk < 0 &&
MPFR_GET_EXP (z) == __gmpfr_emin - 1 - lk && mpfr_powerof2_raw (z))
- /* Rounding to nearest, real result > z * 2^k = 2^(emin - 2),
- * underflow case: we will obtain the correct result and exceptions
- * by replacing z by nextabove(z).
- */
- mpfr_nextabove (z);
+ /* Rounding to nearest, exact result > z * 2^k = 2^(emin - 2),
+ * and underflow case because the rounded result assuming an
+ * unbounded exponent range is 2^(emin - 2). We need to round
+ * to 2^(emin - 1), i.e. to round toward +inf.
+ * Note: the old code was using "mpfr_nextabove (z);" instead of
+ * setting rnd_mode to MPFR_RNDU for the call to mpfr_mul_2si, but
+ * this was incorrect in precision 1 because in this precision,
+ * mpfr_nextabove gave 2^(emin - 1), which is representable,
+ * so that mpfr_mul_2si did not generate the wanted underflow
+ * (the value was correct, but the underflow flag was missing). */
+ rnd_mode = MPFR_RNDU;
MPFR_CLEAR_FLAGS ();
inex2 = mpfr_mul_2si (z, z, lk, rnd_mode);
if (inex2) /* underflow or overflow */
@@ -385,10 +394,10 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg y[%Pu]=%.*Rg rnd=%d",
+ (("x[%Pd]=%.*Rg y[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x,
mpfr_get_prec (y), mpfr_log_prec, y, rnd_mode),
- ("z[%Pu]=%.*Rg inexact=%d",
+ ("z[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (z), mpfr_log_prec, z, inexact));
if (MPFR_ARE_SINGULAR (x, y))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow_si.c b/Build/source/libs/mpfr/mpfr-src/src/pow_si.c
index 22cda32e129..c1f522f5763 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pow_si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow_si.c
@@ -43,9 +43,9 @@ int
POW_S (mpfr_ptr y, mpfr_srcptr x, TYPE n, mpfr_rnd_t rnd)
{
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg n=%" FSPEC "d rnd=%d",
+ (("x[%Pd]=%.*Rg n=%" FSPEC "d rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, n, rnd),
- ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
+ ("y[%Pd]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
if (n >= 0)
return POW_U (y, x, n, rnd);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c b/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c
index b59399135c1..d82e68ffdc5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c
@@ -44,9 +44,9 @@ POW_U (mpfr_ptr y, mpfr_srcptr x, UTYPE n, mpfr_rnd_t rnd)
MPFR_BLOCK_DECL (flags);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg n=%" FSPEC "u rnd=%d",
+ (("x[%Pd]=%.*Rg n=%" FSPEC "u rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, n, rnd),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
/* x^0 = 1 for any x, even a NaN */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow_z.c b/Build/source/libs/mpfr/mpfr-src/src/pow_z.c
index 2388ed081df..6f930ac12f2 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pow_z.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow_z.c
@@ -41,9 +41,9 @@ mpfr_pow_pos_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t rnd, int cr)
MPFR_BLOCK_DECL (flags);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg z=%Zd rnd=%d cr=%d",
+ (("x[%Pd]=%.*Rg z=%Zd rnd=%d cr=%d",
mpfr_get_prec (x), mpfr_log_prec, x, z, rnd, cr),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
MPFR_ASSERTD (mpz_sgn (z) != 0);
@@ -171,9 +171,9 @@ mpfr_pow_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t rnd)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg z=%Zd rnd=%d",
+ (("x[%Pd]=%.*Rg z=%Zd rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, z, rnd),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
/* x^0 = 1 for any x, even a NaN */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c b/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c
index c6ca40ba107..67c98557d59 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c
@@ -463,10 +463,11 @@ mpfr_rec_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
int s, cy, inex;
mpfr_limb_ptr x;
MPFR_TMP_DECL(marker);
+ MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (u), mpfr_log_prec, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r, inex));
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (u), mpfr_log_prec, u, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (r), mpfr_log_prec, r, inex));
/* special values */
if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(u)))
@@ -530,6 +531,7 @@ mpfr_rec_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
wp = rp + 11;
if (wp < rn * GMP_NUMB_BITS)
wp = rn * GMP_NUMB_BITS;
+ MPFR_ZIV_INIT (loop, wp);
for (;;)
{
MPFR_TMP_MARK (marker);
@@ -561,8 +563,9 @@ mpfr_rec_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
}
MPFR_TMP_FREE(marker);
- wp += GMP_NUMB_BITS;
+ MPFR_ZIV_NEXT (loop, wp);
}
+ MPFR_ZIV_FREE (loop);
cy = mpfr_round_raw (MPFR_MANT(r), x, wp, 0, rp, rnd_mode, &inex);
MPFR_EXP(r) = - (MPFR_EXP(u) - 1 - s) / 2;
if (MPFR_UNLIKELY(cy != 0))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/reldiff.c b/Build/source/libs/mpfr/mpfr-src/src/reldiff.c
index 832bf4d2b5e..5adf6a351ed 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/reldiff.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/reldiff.c
@@ -30,31 +30,25 @@ mpfr_reldiff (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
if (MPFR_ARE_SINGULAR (b, c))
{
- if (MPFR_IS_NAN(b) || MPFR_IS_NAN(c))
+ if (MPFR_IS_NAN (b) || MPFR_IS_INF (b) || MPFR_IS_NAN (c) ||
+ (MPFR_IS_ZERO (b) && MPFR_IS_ZERO (c)))
{
- MPFR_SET_NAN(a);
+ MPFR_SET_NAN (a);
return;
}
- else if (MPFR_IS_INF(b))
- {
- if (MPFR_IS_INF (c) && (MPFR_SIGN (c) == MPFR_SIGN (b)))
- MPFR_SET_ZERO(a);
- else
- MPFR_SET_NAN(a);
- return;
- }
- else if (MPFR_IS_INF(c))
+ if (MPFR_IS_ZERO (b) || MPFR_IS_INF (c))
{
MPFR_SET_SAME_SIGN (a, b);
MPFR_SET_INF (a);
return;
}
- else if (MPFR_IS_ZERO(b)) /* reldiff = abs(c)/c = sign(c) */
- {
- mpfr_set_si (a, MPFR_INT_SIGN (c), rnd_mode);
- return;
- }
- /* Fall through */
+ /* The case c = 0 with b regular, which should give sign(b) exactly,
+ cannot be optimized here as it is documented in the MPFR manual
+ that this function just computes abs(b-c)/b using the precision
+ of a and the rounding mode rnd_mode for all operations. So let's
+ prefer the potentially "incorrect" result. Note that the correct
+ result is not necessarily better because if could break properties
+ (like monotonicity?) implied by the documentation. */
}
if (a == b)
@@ -64,8 +58,8 @@ mpfr_reldiff (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
}
mpfr_sub (a, b, c, rnd_mode);
- mpfr_abs (a, a, rnd_mode); /* for compatibility with MPF */
- mpfr_div (a, a, (a == b) ? b_copy : b, rnd_mode);
+ MPFR_SET_SIGN (a, 1);
+ mpfr_div (a, a, a == b ? b_copy : b, rnd_mode);
if (a == b)
mpfr_clear (b_copy);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/root.c b/Build/source/libs/mpfr/mpfr-src/src/root.c
index 386846ad2c6..e2e3a599d1c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/root.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/root.c
@@ -54,9 +54,9 @@ mpfr_rootn_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg k=%lu rnd=%d",
+ (("x[%Pd]=%.*Rg k=%lu rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, k, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY (k <= 1))
@@ -306,9 +306,9 @@ mpfr_rootn_si (mpfr_ptr y, mpfr_srcptr x, long k, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg k=%lu rnd=%d",
+ (("x[%Pd]=%.*Rg k=%lu rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, k, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
if (k >= 0)
@@ -441,9 +441,9 @@ int
mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode)
{
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg k=%lu rnd=%d",
+ (("x[%Pd]=%.*Rg k=%lu rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, k, rnd_mode),
- ("y[%Pu]=%.*Rg",
+ ("y[%Pd]=%.*Rg",
mpfr_get_prec (y), mpfr_log_prec, y));
/* Like mpfr_rootn_ui... */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_prec.c b/Build/source/libs/mpfr/mpfr-src/src/set_prec.c
index 54d610d6776..d673bea45d6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_prec.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_prec.c
@@ -27,7 +27,7 @@ mpfr_set_prec (mpfr_ptr x, mpfr_prec_t p)
{
mp_size_t xsize, xoldsize;
- MPFR_LOG_MSG (("prec=%Pu\n", p));
+ MPFR_LOG_MSG (("prec=%Pd\n", p));
/* first, check if p is correct */
MPFR_ASSERTN (MPFR_PREC_COND (p));
diff --git a/Build/source/libs/mpfr/mpfr-src/src/si_op.c b/Build/source/libs/mpfr/mpfr-src/src/si_op.c
index 71fa91fcf64..3925a366585 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/si_op.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/si_op.c
@@ -33,9 +33,9 @@ mpfr_add_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode)
int res;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg u=%ld rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(y), mpfr_log_prec, y, res));
if (u >= 0)
@@ -52,9 +52,9 @@ mpfr_sub_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode)
int res;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg u=%ld rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(y), mpfr_log_prec, y, res));
if (u >= 0)
@@ -71,9 +71,9 @@ mpfr_si_sub (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
int res;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg u=%ld rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(y), mpfr_log_prec, y, res));
if (u >= 0)
@@ -95,9 +95,9 @@ mpfr_mul_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode)
int res;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg u=%ld rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(y), mpfr_log_prec, y, res));
if (u >= 0)
@@ -119,9 +119,9 @@ mpfr_div_si (mpfr_ptr y, mpfr_srcptr x, long int u, mpfr_rnd_t rnd_mode)
int res;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg u=%ld rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(y), mpfr_log_prec, y, res));
if (u >= 0)
@@ -142,9 +142,9 @@ mpfr_si_div (mpfr_ptr y, long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
int res;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%ld rnd=%d",
+ (("x[%Pd]=%.*Rg u=%ld rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(y), mpfr_log_prec, y, res));
if (u >= 0)
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sin.c b/Build/source/libs/mpfr/mpfr-src/src/sin.c
index 7b4252e6d55..82d78f72daf 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sin.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sin.c
@@ -45,8 +45,8 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c b/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c
index 3960759633b..034ed980271 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c
@@ -61,8 +61,8 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
}
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("sin[%Pu]=%.*Rg cos[%Pu]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y,
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("sin[%Pd]=%.*Rg cos[%Pd]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y,
mpfr_get_prec (z), mpfr_log_prec, z));
MPFR_SAVE_EXPO_MARK (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sinh.c b/Build/source/libs/mpfr/mpfr-src/src/sinh.c
index 6d54ba887cc..69efdf21c4c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sinh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sinh.c
@@ -33,8 +33,8 @@ mpfr_sinh (mpfr_ptr y, mpfr_srcptr xt, mpfr_rnd_t rnd_mode)
int inexact;
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (xt)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c b/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c
index d3602cc8245..9566355616b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c
@@ -37,9 +37,9 @@ mpfr_sinh_cosh (mpfr_ptr sh, mpfr_ptr ch, mpfr_srcptr xt, mpfr_rnd_t rnd_mode)
MPFR_ASSERTN (sh != ch);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d",
+ (("x[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
- ("sh[%Pu]=%.*Rg ch[%Pu]=%.*Rg",
+ ("sh[%Pd]=%.*Rg ch[%Pd]=%.*Rg",
mpfr_get_prec (sh), mpfr_log_prec, sh,
mpfr_get_prec (ch), mpfr_log_prec, ch));
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sinu.c b/Build/source/libs/mpfr/mpfr-src/src/sinu.c
index 9e4e1ed017c..4c0aa20db9c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sinu.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sinu.c
@@ -43,9 +43,9 @@ mpfr_sinu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg u=%lu rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, u,
+ ("x[%Pd]=%.*Rg u=%lu rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, u,
rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (u == 0 || MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sqr.c b/Build/source/libs/mpfr/mpfr-src/src/sqr.c
index 74309be6fcb..195019851c4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sqr.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sqr.c
@@ -516,8 +516,8 @@ mpfr_sqr (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
MPFR_TMP_DECL(marker);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (b), mpfr_log_prec, b, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (b), mpfr_log_prec, b, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (a), mpfr_log_prec, a, inexact));
/* deal with special cases */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sqrt.c b/Build/source/libs/mpfr/mpfr-src/src/sqrt.c
index 4252122a0fc..b6f293b2629 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sqrt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sqrt.c
@@ -517,8 +517,8 @@ mpfr_sqrt (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode)
MPFR_TMP_DECL(marker);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (u), mpfr_log_prec, u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (u), mpfr_log_prec, u, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (r), mpfr_log_prec, r, inexact));
if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(u)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c b/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c
index 318daaa03ad..18a612f90bb 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c
@@ -30,7 +30,7 @@ mpfr_sqrt_ui (mpfr_ptr r, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_LOG_FUNC
(("u=%lu rnd=%d", u, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec(r), mpfr_log_prec, r, inex));
if (u != 0)
diff --git a/Build/source/libs/mpfr/mpfr-src/src/strtofr.c b/Build/source/libs/mpfr/mpfr-src/src/strtofr.c
index a95d242bea2..7e699523caa 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/strtofr.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/strtofr.c
@@ -242,7 +242,10 @@ parse_string (mpfr_ptr x, struct parsed_string *pstr,
pstr->mantissa = NULL;
/* Optional leading whitespace */
- while (isspace((unsigned char) *str)) str++;
+ /* For non-"C" locales, the ISO C standard allows isspace(0) to
+ return true. So we need to stop explicitly on '\0'. */
+ while (*str != '\0' && isspace ((unsigned char) *str))
+ str++;
/* An optional sign `+' or `-' */
pstr->negative = (*str == '-');
@@ -425,7 +428,8 @@ parse_string (mpfr_ptr x, struct parsed_string *pstr,
/* Remove 0's at the beginning and end of mantissa[0..prec-1] */
mant = pstr->mantissa;
for ( ; (pstr->prec > 0) && (*mant == 0) ; mant++, pstr->prec--)
- pstr->exp_base--;
+ if (MPFR_LIKELY (pstr->exp_base != MPFR_EXP_MIN))
+ pstr->exp_base--;
for ( ; (pstr->prec > 0) && (mant[pstr->prec - 1] == 0); pstr->prec--);
pstr->mant = mant;
@@ -738,7 +742,9 @@ parsed_string_to_mpfr (mpfr_ptr x, struct parsed_string *pstr, mpfr_rnd_t rnd)
MPN_ZERO (y0, ysize);
/* pstr_size - pstr->exp_base can overflow */
- MPFR_SADD_OVERFLOW (exp_z, (mpfr_exp_t) pstr_size, -pstr->exp_base,
+ exp_z = pstr->exp_base == MPFR_EXP_MIN ?
+ MPFR_EXP_MAX : -pstr->exp_base; /* avoid integer overflow */
+ MPFR_SADD_OVERFLOW (exp_z, (mpfr_exp_t) pstr_size, exp_z,
mpfr_exp_t, mpfr_uexp_t,
MPFR_EXP_MIN, MPFR_EXP_MAX,
goto underflow, goto overflow);
@@ -862,7 +868,7 @@ parsed_string_to_mpfr (mpfr_ptr x, struct parsed_string *pstr, mpfr_rnd_t rnd)
err = 0;
}
- MPFR_LOG_MSG (("exact = %d, err = %d, precx = %Pu\n",
+ MPFR_LOG_MSG (("exact = %d, err = %d, precx = %Pd\n",
exact, err, precx));
/* at this point, result is an approximation rounded toward zero
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub.c b/Build/source/libs/mpfr/mpfr-src/src/sub.c
index c1d47e4e461..10978fc0466 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub.c
@@ -26,10 +26,10 @@ MPFR_HOT_FUNCTION_ATTR int
mpfr_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
{
MPFR_LOG_FUNC
- (("b[%Pu]=%.*Rg c[%Pu]=%.*Rg rnd=%d",
+ (("b[%Pd]=%.*Rg c[%Pd]=%.*Rg rnd=%d",
mpfr_get_prec (b), mpfr_log_prec, b,
mpfr_get_prec (c), mpfr_log_prec, c, rnd_mode),
- ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+ ("a[%Pd]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
if (MPFR_ARE_SINGULAR_OR_UBF (b,c))
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub_d.c b/Build/source/libs/mpfr/mpfr-src/src/sub_d.c
index 29f32502bc8..2c0c70e56b3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub_d.c
@@ -32,9 +32,9 @@ mpfr_sub_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("b[%Pu]=%.*Rg c=%.20g rnd=%d",
+ (("b[%Pd]=%.*Rg c=%.20g rnd=%d",
mpfr_get_prec (b), mpfr_log_prec, b, c, rnd_mode),
- ("a[%Pu]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
+ ("a[%Pd]=%.*Rg", mpfr_get_prec (a), mpfr_log_prec, a));
MPFR_SAVE_EXPO_MARK (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c b/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c
index f57c11cdd48..4d4c550440b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c
@@ -28,9 +28,9 @@ int
mpfr_sub_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode)
{
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg u=%lu rnd=%d",
+ (("x[%Pd]=%.*Rg u=%lu rnd=%d",
mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
- ("y[%Pu]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
+ ("y[%Pd]=%.*Rg", mpfr_get_prec (y), mpfr_log_prec, y));
/* (unsigned long) 0 is assumed to be a real 0 (unsigned) */
if (MPFR_UNLIKELY (u == 0))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sum.c b/Build/source/libs/mpfr/mpfr-src/src/sum.c
index 86e1fe4fa30..38de4c39924 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sum.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sum.c
@@ -543,7 +543,7 @@ sum_aux (mpfr_ptr sum, const mpfr_ptr *x, unsigned long n, mpfr_rnd_t rnd,
MPFR_LOG_FUNC
(("n=%lu rnd=%d maxexp=%" MPFR_EXP_FSPEC "d rn=%lu",
n, rnd, (mpfr_eexp_t) maxexp, rn),
- ("sum[%Pu]=%.*Rg", mpfr_get_prec (sum), mpfr_log_prec, sum));
+ ("sum[%Pd]=%.*Rg", mpfr_get_prec (sum), mpfr_log_prec, sum));
MPFR_ASSERTD (rn >= 3 && rn <= n);
@@ -1268,7 +1268,7 @@ mpfr_sum (mpfr_ptr sum, const mpfr_ptr *x, unsigned long n, mpfr_rnd_t rnd)
{
MPFR_LOG_FUNC
(("n=%lu rnd=%d", n, rnd),
- ("sum[%Pu]=%.*Rg", mpfr_get_prec (sum), mpfr_log_prec, sum));
+ ("sum[%Pd]=%.*Rg", mpfr_get_prec (sum), mpfr_log_prec, sum));
if (MPFR_UNLIKELY (n <= 2))
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/tan.c b/Build/source/libs/mpfr/mpfr-src/src/tan.c
index 79f1ad3b348..674c57e64a5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/tan.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/tan.c
@@ -35,8 +35,8 @@ mpfr_tan (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_GROUP_DECL (group);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/tanh.c b/Build/source/libs/mpfr/mpfr-src/src/tanh.c
index 50ec630acfa..32cb72c703f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/tanh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/tanh.c
@@ -32,8 +32,8 @@ mpfr_tanh (mpfr_ptr y, mpfr_srcptr xt, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d",
+ (("x[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (xt), mpfr_log_prec, xt, rnd_mode),
+ ("y[%Pd]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
/* Special value checking */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/tanu.c b/Build/source/libs/mpfr/mpfr-src/src/tanu.c
index a53bb26b15b..330d5bcb425 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/tanu.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/tanu.c
@@ -37,9 +37,9 @@ mpfr_tanu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("x[%Pu]=%.*Rg u=%lu rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, u,
+ ("x[%Pd]=%.*Rg u=%lu rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, u,
rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (y), mpfr_log_prec, y,
inexact));
if (u == 0 || MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ubf.c b/Build/source/libs/mpfr/mpfr-src/src/ubf.c
index b2da806d119..2eac900d3d2 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ubf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ubf.c
@@ -74,10 +74,10 @@ void
mpfr_ubf_mul_exact (mpfr_ubf_ptr a, mpfr_srcptr b, mpfr_srcptr c)
{
MPFR_LOG_FUNC
- (("b[%Pu]=%.*Rg c[%Pu]=%.*Rg",
+ (("b[%Pd]=%.*Rg c[%Pd]=%.*Rg",
mpfr_get_prec (b), mpfr_log_prec, b,
mpfr_get_prec (c), mpfr_log_prec, c),
- ("a[%Pu]=%.*Rg",
+ ("a[%Pd]=%.*Rg",
mpfr_get_prec ((mpfr_ptr) a), mpfr_log_prec, a));
MPFR_ASSERTD ((mpfr_ptr) a != b);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ui_div.c b/Build/source/libs/mpfr/mpfr-src/src/ui_div.c
index 3a6339ca72d..4a2601b9ac2 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ui_div.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ui_div.c
@@ -28,9 +28,9 @@ int
mpfr_ui_div (mpfr_ptr y, unsigned long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
{
MPFR_LOG_FUNC
- (("u=%lu x[%Pu]=%.*Rg rnd=%d",
+ (("u=%lu x[%Pd]=%.*Rg rnd=%d",
u, mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y));
+ ("y[%Pd]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y));
if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c b/Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c
index dd98ea2b13d..fc953c3820d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c
@@ -23,7 +23,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-impl.h"
int
-mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int y, unsigned long int n,
+mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int k, unsigned long int n,
mpfr_rnd_t rnd)
{
mpfr_exp_t err;
@@ -35,22 +35,28 @@ mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int y, unsigned long int n,
MPFR_ZIV_DECL (loop);
MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_LOG_FUNC
+ (("k=%lu n=%lu rnd=%d", k, n, rnd),
+ ("y[%Pd]=%.*Rg inexact=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, inexact));
+
if (MPFR_UNLIKELY (n <= 1))
{
if (n == 1)
- return mpfr_set_ui (x, y, rnd); /* y^1 = y */
+ return mpfr_set_ui (x, k, rnd); /* k^1 = k */
else
- return mpfr_set_ui (x, 1, rnd); /* y^0 = 1 for any y */
+ return mpfr_set_ui (x, 1, rnd); /* k^0 = 1 for any k */
}
- else if (MPFR_UNLIKELY (y <= 1))
+ else if (MPFR_UNLIKELY (k <= 1))
{
- if (y == 1)
+ if (k == 1)
return mpfr_set_ui (x, 1, rnd); /* 1^n = 1 for any n > 0 */
else
return mpfr_set_ui (x, 0, rnd); /* 0^n = 0 for any n > 0 */
}
- for (size_n = 0, m = n; m; size_n++, m >>= 1);
+ for (size_n = 0, m = n; m != 0; size_n++, m >>= 1)
+ ;
MPFR_SAVE_EXPO_MARK (expo);
prec = MPFR_PREC (x) + 3 + size_n;
@@ -60,23 +66,55 @@ mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int y, unsigned long int n,
for (;;)
{
int i = size_n;
+ unsigned int inex_res;
- inexact = mpfr_set_ui (res, y, MPFR_RNDU);
+ inex_res = mpfr_set_ui (res, k, MPFR_RNDU);
err = 1;
/* now 2^(i-1) <= n < 2^i: i=1+floor(log2(n)) */
for (i -= 2; i >= 0; i--)
{
- inexact |= mpfr_sqr (res, res, MPFR_RNDU);
+ inex_res |= mpfr_sqr (res, res, MPFR_RNDU);
err++;
if (n & (1UL << i))
- inexact |= mpfr_mul_ui (res, res, y, MPFR_RNDU);
+ inex_res |= mpfr_mul_ui (res, res, k, MPFR_RNDU);
}
+
+ if (MPFR_UNLIKELY (MPFR_IS_INF (res)))
+ {
+ mpfr_t kf;
+ mpz_t z;
+ int size_k;
+ MPFR_BLOCK_DECL (flags);
+
+ /* Let's handle the overflow by calling mpfr_pow_z.
+ Alternatively, we could call mpfr_pow_ui; this would
+ need a bit shorter code below, but mpfr_pow_ui handles
+ the overflow by calling mpfr_pow_z, so that calling
+ mpfr_pow_z directly should be a bit more efficient. */
+
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (res);
+ for (size_k = 0, m = k; m != 0; size_k++, m >>= 1)
+ ;
+ mpfr_init2 (kf, size_k);
+ inexact = mpfr_set_ui (kf, k, MPFR_RNDN);
+ MPFR_ASSERTD (inexact == 0);
+ mpz_init (z);
+ mpz_set_ui (z, n);
+ MPFR_BLOCK (flags, inexact = mpfr_pow_z (x, kf, z, rnd););
+ mpz_clear (z);
+ mpfr_clear (kf);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, flags);
+ goto end;
+ }
+
/* since the loop is executed floor(log2(n)) times,
we have err = 1+floor(log2(n)).
Since prec >= MPFR_PREC(x) + 4 + floor(log2(n)), prec > err */
err = prec - err;
- if (MPFR_LIKELY (inexact == 0
+ MPFR_LOG_VAR (res);
+ if (MPFR_LIKELY (!inex_res
|| MPFR_CAN_ROUND (res, err, MPFR_PREC (x), rnd)))
break;
@@ -90,6 +128,7 @@ mpfr_ui_pow_ui (mpfr_ptr x, unsigned long int y, unsigned long int n,
mpfr_clear (res);
+ end:
MPFR_SAVE_EXPO_FREE (expo);
return mpfr_check_range (x, inexact, rnd);
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c b/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c
index 512eb8a6756..06b7db27b38 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c
@@ -27,9 +27,9 @@ int
mpfr_ui_sub (mpfr_ptr y, unsigned long int u, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
{
MPFR_LOG_FUNC
- (("u=%lu x[%Pu]=%.*Rg rnd=%d",
+ (("u=%lu x[%Pd]=%.*Rg rnd=%d",
u, mpfr_get_prec(x), mpfr_log_prec, x, rnd_mode),
- ("y[%Pu]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y));
+ ("y[%Pd]=%.*Rg", mpfr_get_prec(y), mpfr_log_prec, y));
/* (unsigned long) 0 is assumed to be a real 0 (unsigned) */
if (MPFR_UNLIKELY (u == 0))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c b/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c
index 50282c857b3..b9105446cf1 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c
@@ -880,7 +880,7 @@ struct number_parts
enum pad_t pad_type; /* Padding type */
mpfr_intmax_t pad_size; /* Number of padding characters */
- char sign; /* Sign character */
+ char sign; /* Sign character ('-', '+', ' ', or '\0') */
char *prefix_ptr; /* Pointer to prefix part */
size_t prefix_size; /* Number of characters in *prefix_ptr */
@@ -1067,12 +1067,6 @@ regular_ab (struct number_parts *np, mpfr_srcptr p,
uppercase = spec.spec == 'A';
- /* sign */
- if (MPFR_IS_NEG (p))
- np->sign = '-';
- else if (spec.showsign || spec.space)
- np->sign = spec.showsign ? '+' : ' ';
-
if (spec.spec == 'a' || spec.spec == 'A')
/* prefix part */
{
@@ -1290,12 +1284,6 @@ regular_eg (struct number_parts *np, mpfr_srcptr p,
const int uppercase = spec.spec == 'E' || spec.spec == 'G';
- /* sign */
- if (MPFR_IS_NEG (p))
- np->sign = '-';
- else if (spec.showsign || spec.space)
- np->sign = spec.showsign ? '+' : ' ';
-
/* integral part */
np->ip_size = 1;
if (dec_info == NULL)
@@ -1425,12 +1413,6 @@ regular_fg (struct number_parts *np, mpfr_srcptr p,
and it should have been changed to 6 before the function call) */
MPFR_ASSERTD (spec.prec >= 0);
- /* sign */
- if (MPFR_IS_NEG (p))
- np->sign = '-';
- else if (spec.showsign || spec.space)
- np->sign = spec.showsign ? '+' : ' ';
-
if (MPFR_GET_EXP (p) <= 0)
/* 0 < |p| < 1 */
{
@@ -1725,8 +1707,7 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
/* WARNING: left justification means right space padding */
np->pad_type = spec.left ? RIGHT : spec.pad == '0' ? LEADING_ZEROS : LEFT;
np->pad_size = 0;
- np->sign = '\0';
- np->prefix_ptr =NULL;
+ np->prefix_ptr = NULL;
np->prefix_size = 0;
np->thousands_sep = '\0';
np->ip_ptr = NULL;
@@ -1746,6 +1727,12 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
uppercase = spec.spec == 'A' || spec.spec == 'E' || spec.spec == 'F'
|| spec.spec == 'G';
+ /* The sign/space rule is the same for all cases. */
+ np->sign =
+ MPFR_IS_NEG (p) ? '-' :
+ spec.showsign ? '+' :
+ spec.space ? ' ' : '\0';
+
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (p)))
{
if (MPFR_IS_NAN (p))
@@ -1767,9 +1754,6 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
with left spaces instead */
np->pad_type = LEFT;
- if (MPFR_IS_NEG (p))
- np->sign = '-';
-
np->ip_size = MPFR_INF_STRING_LENGTH;
str = (char *) mpfr_allocate_func (1 + np->ip_size);
strcpy (str, uppercase ? MPFR_INF_STRING_UC : MPFR_INF_STRING_LC);
@@ -1781,11 +1765,6 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
/* note: for 'g' spec, zero is always displayed with 'f'-style with
precision spec.prec - 1 and the trailing zeros are removed unless
the flag '#' is used. */
- if (MPFR_IS_NEG (p))
- /* signed zero */
- np->sign = '-';
- else if (spec.showsign || spec.space)
- np->sign = spec.showsign ? '+' : ' ';
if (spec.spec == 'a' || spec.spec == 'A')
/* prefix part */
@@ -1849,9 +1828,6 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
/* change to right justification padding with left spaces */
np->pad_type = LEFT;
- if (MPFR_IS_NEG (p))
- np->sign = '-';
-
np->ip_size = 3;
str = (char *) mpfr_allocate_func (1 + np->ip_size);
strcpy (str, uppercase ? "UBF" : "ubf");
@@ -1888,7 +1864,7 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
precision T-1.
where T is the threshold computed below and X is the exponent
that would be displayed with style 'e' and precision T-1. */
- int threshold;
+ mpfr_intmax_t threshold;
mpfr_exp_t x, e, k;
struct decimal_info dec_info;
@@ -1920,9 +1896,15 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
e = e <= 0 ? k : (e + 2) / 3 + (k <= 0 ? 0 : k);
MPFR_ASSERTD (e >= 1);
+ if (e > threshold)
+ e = threshold;
+
+ /* error if e does not fit in size_t (for mpfr_get_str) */
+ if (e > (size_t) -1)
+ goto error;
+
dec_info.str = mpfr_get_str (NULL, &dec_info.exp, 10,
- e < threshold ? e : threshold,
- p, spec.rnd_mode);
+ e, p, spec.rnd_mode);
register_string (np->sl, dec_info.str);
/* mpfr_get_str corresponds to a significand between 0.1 and 1,
whereas here we want a significand between 1 and 10. */
@@ -2030,7 +2012,7 @@ sprnt_fp (struct string_buffer *buf, mpfr_srcptr p,
if (np.pad_type == LEFT && np.pad_size != 0)
buffer_pad (buf, ' ', np.pad_size);
- /* sign character (may be '-', '+', or ' ') */
+ /* sign character (may be '-', '+', ' ', or '\0') */
if (np.sign)
buffer_pad (buf, np.sign, 1);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/version.c b/Build/source/libs/mpfr/mpfr-src/src/version.c
index 25d88f71839..d0575324ca6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/version.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/version.c
@@ -25,5 +25,5 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
const char *
mpfr_get_version (void)
{
- return "4.2.0";
+ return "4.2.1";
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/yn.c b/Build/source/libs/mpfr/mpfr-src/src/yn.c
index c4d48668107..e33b3a8c5a4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/yn.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/yn.c
@@ -154,8 +154,8 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC
- (("n=%ld x[%Pu]=%.*Rg rnd=%d", n, mpfr_get_prec (z), mpfr_log_prec, z, r),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (res), mpfr_log_prec, res, inex));
+ (("n=%ld x[%Pd]=%.*Rg rnd=%d", n, mpfr_get_prec (z), mpfr_log_prec, z, r),
+ ("y[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (res), mpfr_log_prec, res, inex));
absn = SAFE_ABS (unsigned long, n);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/zeta.c b/Build/source/libs/mpfr/mpfr-src/src/zeta.c
index 18c7e179f29..e66ff908b95 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/zeta.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/zeta.c
@@ -447,8 +447,8 @@ mpfr_zeta (mpfr_ptr z, mpfr_srcptr s, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_DECL (expo);
MPFR_LOG_FUNC (
- ("s[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (s), mpfr_log_prec, s, rnd_mode),
- ("z[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (z), mpfr_log_prec, z, inex));
+ ("s[%Pd]=%.*Rg rnd=%d", mpfr_get_prec (s), mpfr_log_prec, s, rnd_mode),
+ ("z[%Pd]=%.*Rg inexact=%d", mpfr_get_prec (z), mpfr_log_prec, z, inex));
/* Zero, Nan or Inf ? */
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (s)))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c b/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c
index dcbb49f2d8b..a2b3b6cd026 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c
@@ -29,8 +29,8 @@ mpfr_zeta_ui (mpfr_ptr z, unsigned long m, mpfr_rnd_t r)
MPFR_ZIV_DECL (loop);
MPFR_LOG_FUNC
- (("m=%lu rnd=%d prec=%Pu", m, r, mpfr_get_prec (z)),
- ("z[%Pu]=%.*Rg", mpfr_get_prec (z), mpfr_log_prec, z));
+ (("m=%lu rnd=%d prec=%Pd", m, r, mpfr_get_prec (z)),
+ ("z[%Pd]=%.*Rg", mpfr_get_prec (z), mpfr_log_prec, z));
if (m == 0) /* zeta(0) = -1/2 */
return mpfr_set_si_2exp (z, -1, -1, r);
diff --git a/Build/source/libs/mpfr/version.ac b/Build/source/libs/mpfr/version.ac
index 79421eed728..7ff9440ab24 100644
--- a/Build/source/libs/mpfr/version.ac
+++ b/Build/source/libs/mpfr/version.ac
@@ -8,4 +8,4 @@ dnl
dnl --------------------------------------------------------
dnl
dnl m4-include this file to define the current mpfr version
-m4_define([mpfr_version], [4.2.0])
+m4_define([mpfr_version], [4.2.1])