summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2023-01-12 04:40:09 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2023-01-12 04:40:09 +0000
commit54cbc0287ddd0c6ed04f94917243ae6000cbafd0 (patch)
tree0a5f4f0dc3bbaf54b631d3bc43aa5ef1a13a0e88 /Build
parentdca8720e9f7d4dda24da9c918790ddc66f4e42e6 (diff)
mpfr 4.2.0
git-svn-id: svn://tug.org/texlive/trunk@65526 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/libs/README2
-rw-r--r--Build/source/libs/mpfr/ChangeLog5
-rw-r--r--Build/source/libs/mpfr/Makefile.am20
-rw-r--r--Build/source/libs/mpfr/Makefile.in44
-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-TL12
-rwxr-xr-xBuild/source/libs/mpfr/configure20
-rw-r--r--Build/source/libs/mpfr/mpfr-src/BUGS2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/ChangeLog3537
-rw-r--r--Build/source/libs/mpfr/mpfr-src/INSTALL55
-rw-r--r--Build/source/libs/mpfr/mpfr-src/Makefile.am17
-rw-r--r--Build/source/libs/mpfr/mpfr-src/NEWS27
-rw-r--r--Build/source/libs/mpfr/mpfr-src/README4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/TODO100
-rw-r--r--Build/source/libs/mpfr/mpfr-src/VERSION2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/acinclude.m459
-rw-r--r--Build/source/libs/mpfr/mpfr-src/configure.ac23
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/Makefile.am93
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/acos.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/acosh.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/acosu.c169
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add1.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add1sp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add1sp1_extracted.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add_d.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/add_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/agm.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ai.c28
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/amd/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/asin.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/asinh.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/asinu.c164
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atan.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atan2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atan2u.c361
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atanh.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/atanu.c189
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/bernoulli.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/beta.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/buildopt.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cache.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cbrt.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/check.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/clear.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/clears.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cmp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cmp2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cmp_d.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cmp_si.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cmpabs.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cmpabs_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/comparisons.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/compound.c224
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/const_catalan.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/const_euler.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/constant.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/copysign.c13
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cos.c6
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cosh.c6
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cosu.c254
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/cot.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/coth.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/csc.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/csch.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/d_div.c6
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/d_sub.c6
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/digamma.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/dim.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_2exp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_2si.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_2ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_d.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/div_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/dot.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/dump.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/eint.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/eq.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/erandom.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/erf.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/erfc.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exceptions.c5
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp10.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp10m1.c179
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp2.c44
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp2m1.c185
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp3.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/exp_2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/expm1.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/extract.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/factorial.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_s.h4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_sint.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_slong.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_u.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_uint.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fma.c10
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fmma.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c72
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fms.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fpif.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/frac.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/free_cache.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/frexp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/gamma.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/gamma_inc.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/generic/coverage/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_d.c12
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_d128.c32
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_d64.c11
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_exp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_f.c6
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_float128.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_flt.c7
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_ld.c7
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_q.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_si.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_sj.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_str.c105
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_uj.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_z.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/get_z_2exp.c (renamed from Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c)2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/gmp_op.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/grandom.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/hypot.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/init.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/init2.c6
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/inits.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/inits2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/inp_str.c6
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/invert_limb.h106
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/invsqrt_limb.h17
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/isinf.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/isinteger.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/isnan.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/isnum.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/isqrt.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/isregular.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/iszero.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/jn.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c6
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/li2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/lngamma.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log.c16
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log10.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log10p1.c210
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log1p.c12
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log2p1.c168
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/log_ui.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/logging.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/min_prec.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/minmax.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mips/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/modf.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mparam_h.in11
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-cvers.h8
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h96
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h193
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-sassert.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpfr.h70
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_1_extracted.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_2si.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_d.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mul_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/mulders.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/nbits_ulong.c56
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/neg.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/next.c20
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/nrandom.c7
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/odd_p.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/out_str.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pool.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow_si.c62
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow_sj.c40
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow_ui.c42
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow_uj.c62
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/pow_z.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/powerof2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/powr.c60
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/print_raw.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/printf.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/random_deviate.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/random_deviate.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/reldiff.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/rem1.c10
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/rint.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/rndna.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/root.c143
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/round_near_x.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/round_p.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/round_prec.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/scale2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sec.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sech.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set.c18
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_d.c8
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_d128.c5
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_d64.c5
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_exp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_f.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_float128.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_flt.c8
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_inf.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_ld.c26
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_nan.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_prec.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_q.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_rnd.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_si.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_sj.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_str.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_uj.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_z.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_z_2exp.c (renamed from Build/source/libs/mpfr/mpfr-src/src/set_z_exp.c)2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/set_zero.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/setmax.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/setmin.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/setsign.c13
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sgn.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/si_op.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/signbit.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sin.c17
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sin_cos.c14
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sinh.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sinu.c240
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sqr.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sqrt.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c15
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/stack_interface.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/strtofr.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub1.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub1sp.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub1sp1_extracted.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub_d.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sub_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/subnormal.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/sum.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/swap.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/tan.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/tanh.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/tanu.c227
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/total_order.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ubf.c14
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ui_div.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ui_pow.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ui_pow_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/ui_sub.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/urandom.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/urandomb.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/vasprintf.c51
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/version.c4
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/volatile.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/x86_64/mparam.h2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/yn.c13
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/zeta.c51
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c2
-rw-r--r--Build/source/libs/mpfr/mpfr-src/version-ext.sh12
-rw-r--r--Build/source/libs/mpfr/version.ac2
310 files changed, 7458 insertions, 1315 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README
index aaf3bef0996..75b31de8408 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.1.1 - checked 18nov22
+mpfr 4.2.0 - checked 12jan23
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 9aa279fea38..275780af649 100644
--- a/Build/source/libs/mpfr/ChangeLog
+++ b/Build/source/libs/mpfr/ChangeLog
@@ -1,3 +1,8 @@
+2023-01-12 Akira Kakuto <kakuto@jcom.zaq.ne.jp>
+
+ Import mpfr-4.2.0.
+ * version.ac, Makefile.am: Adjust.
+
2022-11-18 Akira Kakuto <kakuto@jcom.zaq.ne.jp>
Import mpfr-4.1.1.
diff --git a/Build/source/libs/mpfr/Makefile.am b/Build/source/libs/mpfr/Makefile.am
index 2b0f29ffad2..26ee6161283 100644
--- a/Build/source/libs/mpfr/Makefile.am
+++ b/Build/source/libs/mpfr/Makefile.am
@@ -71,7 +71,7 @@ nodist_libmpfr_a_SOURCES = \
@MPFR_TREE@/src/get_si.c \
@MPFR_TREE@/src/get_str.c \
@MPFR_TREE@/src/get_z.c \
- @MPFR_TREE@/src/get_z_exp.c \
+ @MPFR_TREE@/src/get_z_2exp.c \
@MPFR_TREE@/src/get_ui.c \
@MPFR_TREE@/src/gmp_op.c \
@MPFR_TREE@/src/init.c \
@@ -113,7 +113,7 @@ nodist_libmpfr_a_SOURCES = \
@MPFR_TREE@/src/set_str.c \
@MPFR_TREE@/src/set_ui_2exp.c \
@MPFR_TREE@/src/set_z.c \
- @MPFR_TREE@/src/set_z_exp.c \
+ @MPFR_TREE@/src/set_z_2exp.c \
@MPFR_TREE@/src/set_zero.c \
@MPFR_TREE@/src/setmax.c \
@MPFR_TREE@/src/setmin.c \
@@ -138,10 +138,14 @@ nodist_libmpfr_a_SOURCES = \
unused_sources = \
@MPFR_TREE@/src/acos.c \
@MPFR_TREE@/src/acosh.c \
+ @MPFR_TREE@/src/acosu.c \
@MPFR_TREE@/src/ai.c \
@MPFR_TREE@/src/asin.c \
+ @MPFR_TREE@/src/asinu.c \
@MPFR_TREE@/src/asinh.c \
@MPFR_TREE@/src/atanh.c \
+ @MPFR_TREE@/src/atan2u.c \
+ @MPFR_TREE@/src/atanu.c \
@MPFR_TREE@/src/bernoulli.c \
@MPFR_TREE@/src/beta.c \
@MPFR_TREE@/src/buildopt.c \
@@ -150,8 +154,10 @@ unused_sources = \
@MPFR_TREE@/src/cmp_d.c \
@MPFR_TREE@/src/cmp_ld.c \
@MPFR_TREE@/src/cmpabs_ui.c \
+ @MPFR_TREE@/src/compound.c \
@MPFR_TREE@/src/copysign.c \
@MPFR_TREE@/src/cosh.c \
+ @MPFR_TREE@/src/cosu.c \
@MPFR_TREE@/src/cot.c \
@MPFR_TREE@/src/coth.c \
@MPFR_TREE@/src/csc.c \
@@ -170,6 +176,8 @@ unused_sources = \
@MPFR_TREE@/src/erf.c \
@MPFR_TREE@/src/erfc.c \
@MPFR_TREE@/src/exp10.c \
+ @MPFR_TREE@/src/exp10m1.c \
+ @MPFR_TREE@/src/exp2m1.c \
@MPFR_TREE@/src/expm1.c \
@MPFR_TREE@/src/factorial.c \
@MPFR_TREE@/src/fits_intmax.c \
@@ -179,6 +187,7 @@ unused_sources = \
@MPFR_TREE@/src/fits_ushort.c \
@MPFR_TREE@/src/fma.c \
@MPFR_TREE@/src/fmma.c \
+ @MPFR_TREE@/src/fmod_ui.c \
@MPFR_TREE@/src/fms.c \
@MPFR_TREE@/src/fpif.c \
@MPFR_TREE@/src/frac.c \
@@ -207,6 +216,8 @@ unused_sources = \
@MPFR_TREE@/src/iszero.c \
@MPFR_TREE@/src/jn.c \
@MPFR_TREE@/src/li2.c \
+ @MPFR_TREE@/src/log10p1.c \
+ @MPFR_TREE@/src/log2p1.c \
@MPFR_TREE@/src/lngamma.c \
@MPFR_TREE@/src/log10.c \
@MPFR_TREE@/src/log1p.c \
@@ -227,6 +238,9 @@ unused_sources = \
@MPFR_TREE@/src/pow_ui.c \
@MPFR_TREE@/src/pow_z.c \
@MPFR_TREE@/src/print_raw.c \
+ @MPFR_TREE@/src/powr.c \
+ @MPFR_TREE@/src/pow_sj.c \
+ @MPFR_TREE@/src/pow_uj.c \
@MPFR_TREE@/src/print_rnd_mode.c \
@MPFR_TREE@/src/printf.c \
@MPFR_TREE@/src/random_deviate.c \
@@ -253,6 +267,7 @@ unused_sources = \
@MPFR_TREE@/src/setsign.c \
@MPFR_TREE@/src/signbit.c \
@MPFR_TREE@/src/sinh.c \
+ @MPFR_TREE@/src/sinu.c \
@MPFR_TREE@/src/sinh_cosh.c \
@MPFR_TREE@/src/stack_interface.c \
@MPFR_TREE@/src/sub_d.c \
@@ -261,6 +276,7 @@ unused_sources = \
@MPFR_TREE@/src/sum.c \
@MPFR_TREE@/src/tan.c \
@MPFR_TREE@/src/tanh.c \
+ @MPFR_TREE@/src/tanu.c \
@MPFR_TREE@/src/total_order.c \
@MPFR_TREE@/src/uceil_exp2.c \
@MPFR_TREE@/src/uceil_log2.c \
diff --git a/Build/source/libs/mpfr/Makefile.in b/Build/source/libs/mpfr/Makefile.in
index ced169bed73..25d501acff8 100644
--- a/Build/source/libs/mpfr/Makefile.in
+++ b/Build/source/libs/mpfr/Makefile.in
@@ -157,7 +157,7 @@ nodist_libmpfr_a_OBJECTS = @MPFR_TREE@/src/abort_prec_max.$(OBJEXT) \
@MPFR_TREE@/src/get_si.$(OBJEXT) \
@MPFR_TREE@/src/get_str.$(OBJEXT) \
@MPFR_TREE@/src/get_z.$(OBJEXT) \
- @MPFR_TREE@/src/get_z_exp.$(OBJEXT) \
+ @MPFR_TREE@/src/get_z_2exp.$(OBJEXT) \
@MPFR_TREE@/src/get_ui.$(OBJEXT) \
@MPFR_TREE@/src/gmp_op.$(OBJEXT) \
@MPFR_TREE@/src/init.$(OBJEXT) @MPFR_TREE@/src/init2.$(OBJEXT) \
@@ -194,7 +194,7 @@ nodist_libmpfr_a_OBJECTS = @MPFR_TREE@/src/abort_prec_max.$(OBJEXT) \
@MPFR_TREE@/src/set_str.$(OBJEXT) \
@MPFR_TREE@/src/set_ui_2exp.$(OBJEXT) \
@MPFR_TREE@/src/set_z.$(OBJEXT) \
- @MPFR_TREE@/src/set_z_exp.$(OBJEXT) \
+ @MPFR_TREE@/src/set_z_2exp.$(OBJEXT) \
@MPFR_TREE@/src/set_zero.$(OBJEXT) \
@MPFR_TREE@/src/setmax.$(OBJEXT) \
@MPFR_TREE@/src/setmin.$(OBJEXT) @MPFR_TREE@/src/sgn.$(OBJEXT) \
@@ -277,7 +277,7 @@ am__depfiles_remade = ./$(DEPDIR)/mpfrtest-mpfrtest.Po \
@MPFR_TREE@/src/$(DEPDIR)/get_str.Po \
@MPFR_TREE@/src/$(DEPDIR)/get_ui.Po \
@MPFR_TREE@/src/$(DEPDIR)/get_z.Po \
- @MPFR_TREE@/src/$(DEPDIR)/get_z_exp.Po \
+ @MPFR_TREE@/src/$(DEPDIR)/get_z_2exp.Po \
@MPFR_TREE@/src/$(DEPDIR)/gmp_op.Po \
@MPFR_TREE@/src/$(DEPDIR)/init.Po \
@MPFR_TREE@/src/$(DEPDIR)/init2.Po \
@@ -318,7 +318,7 @@ am__depfiles_remade = ./$(DEPDIR)/mpfrtest-mpfrtest.Po \
@MPFR_TREE@/src/$(DEPDIR)/set_str.Po \
@MPFR_TREE@/src/$(DEPDIR)/set_ui_2exp.Po \
@MPFR_TREE@/src/$(DEPDIR)/set_z.Po \
- @MPFR_TREE@/src/$(DEPDIR)/set_z_exp.Po \
+ @MPFR_TREE@/src/$(DEPDIR)/set_z_2exp.Po \
@MPFR_TREE@/src/$(DEPDIR)/set_zero.Po \
@MPFR_TREE@/src/$(DEPDIR)/setmax.Po \
@MPFR_TREE@/src/$(DEPDIR)/setmin.Po \
@@ -822,7 +822,7 @@ nodist_libmpfr_a_SOURCES = \
@MPFR_TREE@/src/get_si.c \
@MPFR_TREE@/src/get_str.c \
@MPFR_TREE@/src/get_z.c \
- @MPFR_TREE@/src/get_z_exp.c \
+ @MPFR_TREE@/src/get_z_2exp.c \
@MPFR_TREE@/src/get_ui.c \
@MPFR_TREE@/src/gmp_op.c \
@MPFR_TREE@/src/init.c \
@@ -864,7 +864,7 @@ nodist_libmpfr_a_SOURCES = \
@MPFR_TREE@/src/set_str.c \
@MPFR_TREE@/src/set_ui_2exp.c \
@MPFR_TREE@/src/set_z.c \
- @MPFR_TREE@/src/set_z_exp.c \
+ @MPFR_TREE@/src/set_z_2exp.c \
@MPFR_TREE@/src/set_zero.c \
@MPFR_TREE@/src/setmax.c \
@MPFR_TREE@/src/setmin.c \
@@ -889,10 +889,14 @@ nodist_libmpfr_a_SOURCES = \
unused_sources = \
@MPFR_TREE@/src/acos.c \
@MPFR_TREE@/src/acosh.c \
+ @MPFR_TREE@/src/acosu.c \
@MPFR_TREE@/src/ai.c \
@MPFR_TREE@/src/asin.c \
+ @MPFR_TREE@/src/asinu.c \
@MPFR_TREE@/src/asinh.c \
@MPFR_TREE@/src/atanh.c \
+ @MPFR_TREE@/src/atan2u.c \
+ @MPFR_TREE@/src/atanu.c \
@MPFR_TREE@/src/bernoulli.c \
@MPFR_TREE@/src/beta.c \
@MPFR_TREE@/src/buildopt.c \
@@ -901,8 +905,10 @@ unused_sources = \
@MPFR_TREE@/src/cmp_d.c \
@MPFR_TREE@/src/cmp_ld.c \
@MPFR_TREE@/src/cmpabs_ui.c \
+ @MPFR_TREE@/src/compound.c \
@MPFR_TREE@/src/copysign.c \
@MPFR_TREE@/src/cosh.c \
+ @MPFR_TREE@/src/cosu.c \
@MPFR_TREE@/src/cot.c \
@MPFR_TREE@/src/coth.c \
@MPFR_TREE@/src/csc.c \
@@ -921,6 +927,8 @@ unused_sources = \
@MPFR_TREE@/src/erf.c \
@MPFR_TREE@/src/erfc.c \
@MPFR_TREE@/src/exp10.c \
+ @MPFR_TREE@/src/exp10m1.c \
+ @MPFR_TREE@/src/exp2m1.c \
@MPFR_TREE@/src/expm1.c \
@MPFR_TREE@/src/factorial.c \
@MPFR_TREE@/src/fits_intmax.c \
@@ -930,6 +938,7 @@ unused_sources = \
@MPFR_TREE@/src/fits_ushort.c \
@MPFR_TREE@/src/fma.c \
@MPFR_TREE@/src/fmma.c \
+ @MPFR_TREE@/src/fmod_ui.c \
@MPFR_TREE@/src/fms.c \
@MPFR_TREE@/src/fpif.c \
@MPFR_TREE@/src/frac.c \
@@ -958,6 +967,8 @@ unused_sources = \
@MPFR_TREE@/src/iszero.c \
@MPFR_TREE@/src/jn.c \
@MPFR_TREE@/src/li2.c \
+ @MPFR_TREE@/src/log10p1.c \
+ @MPFR_TREE@/src/log2p1.c \
@MPFR_TREE@/src/lngamma.c \
@MPFR_TREE@/src/log10.c \
@MPFR_TREE@/src/log1p.c \
@@ -978,6 +989,9 @@ unused_sources = \
@MPFR_TREE@/src/pow_ui.c \
@MPFR_TREE@/src/pow_z.c \
@MPFR_TREE@/src/print_raw.c \
+ @MPFR_TREE@/src/powr.c \
+ @MPFR_TREE@/src/pow_sj.c \
+ @MPFR_TREE@/src/pow_uj.c \
@MPFR_TREE@/src/print_rnd_mode.c \
@MPFR_TREE@/src/printf.c \
@MPFR_TREE@/src/random_deviate.c \
@@ -1004,6 +1018,7 @@ unused_sources = \
@MPFR_TREE@/src/setsign.c \
@MPFR_TREE@/src/signbit.c \
@MPFR_TREE@/src/sinh.c \
+ @MPFR_TREE@/src/sinu.c \
@MPFR_TREE@/src/sinh_cosh.c \
@MPFR_TREE@/src/stack_interface.c \
@MPFR_TREE@/src/sub_d.c \
@@ -1012,6 +1027,7 @@ unused_sources = \
@MPFR_TREE@/src/sum.c \
@MPFR_TREE@/src/tan.c \
@MPFR_TREE@/src/tanh.c \
+ @MPFR_TREE@/src/tanu.c \
@MPFR_TREE@/src/total_order.c \
@MPFR_TREE@/src/uceil_exp2.c \
@MPFR_TREE@/src/uceil_log2.c \
@@ -1194,7 +1210,7 @@ clean-noinstLIBRARIES:
@MPFR_TREE@/src/$(DEPDIR)/$(am__dirstamp)
@MPFR_TREE@/src/get_z.$(OBJEXT): @MPFR_TREE@/src/$(am__dirstamp) \
@MPFR_TREE@/src/$(DEPDIR)/$(am__dirstamp)
-@MPFR_TREE@/src/get_z_exp.$(OBJEXT): @MPFR_TREE@/src/$(am__dirstamp) \
+@MPFR_TREE@/src/get_z_2exp.$(OBJEXT): @MPFR_TREE@/src/$(am__dirstamp) \
@MPFR_TREE@/src/$(DEPDIR)/$(am__dirstamp)
@MPFR_TREE@/src/get_ui.$(OBJEXT): @MPFR_TREE@/src/$(am__dirstamp) \
@MPFR_TREE@/src/$(DEPDIR)/$(am__dirstamp)
@@ -1283,7 +1299,7 @@ clean-noinstLIBRARIES:
@MPFR_TREE@/src/$(DEPDIR)/$(am__dirstamp)
@MPFR_TREE@/src/set_z.$(OBJEXT): @MPFR_TREE@/src/$(am__dirstamp) \
@MPFR_TREE@/src/$(DEPDIR)/$(am__dirstamp)
-@MPFR_TREE@/src/set_z_exp.$(OBJEXT): @MPFR_TREE@/src/$(am__dirstamp) \
+@MPFR_TREE@/src/set_z_2exp.$(OBJEXT): @MPFR_TREE@/src/$(am__dirstamp) \
@MPFR_TREE@/src/$(DEPDIR)/$(am__dirstamp)
@MPFR_TREE@/src/set_zero.$(OBJEXT): @MPFR_TREE@/src/$(am__dirstamp) \
@MPFR_TREE@/src/$(DEPDIR)/$(am__dirstamp)
@@ -1386,7 +1402,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/get_str.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/get_ui.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/get_z.Po@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/get_z_exp.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/get_z_2exp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/gmp_op.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/init.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/init2.Po@am__quote@ # am--include-marker
@@ -1427,7 +1443,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/set_str.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/set_ui_2exp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/set_z.Po@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/set_z_exp.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/set_z_2exp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/set_zero.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/setmax.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@@MPFR_TREE@/src/$(DEPDIR)/setmin.Po@am__quote@ # am--include-marker
@@ -2042,7 +2058,7 @@ distclean: distclean-recursive
-rm -f @MPFR_TREE@/src/$(DEPDIR)/get_str.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/get_ui.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/get_z.Po
- -rm -f @MPFR_TREE@/src/$(DEPDIR)/get_z_exp.Po
+ -rm -f @MPFR_TREE@/src/$(DEPDIR)/get_z_2exp.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/gmp_op.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/init.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/init2.Po
@@ -2083,7 +2099,7 @@ distclean: distclean-recursive
-rm -f @MPFR_TREE@/src/$(DEPDIR)/set_str.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/set_ui_2exp.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/set_z.Po
- -rm -f @MPFR_TREE@/src/$(DEPDIR)/set_z_exp.Po
+ -rm -f @MPFR_TREE@/src/$(DEPDIR)/set_z_2exp.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/set_zero.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/setmax.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/setmin.Po
@@ -2195,7 +2211,7 @@ maintainer-clean: maintainer-clean-recursive
-rm -f @MPFR_TREE@/src/$(DEPDIR)/get_str.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/get_ui.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/get_z.Po
- -rm -f @MPFR_TREE@/src/$(DEPDIR)/get_z_exp.Po
+ -rm -f @MPFR_TREE@/src/$(DEPDIR)/get_z_2exp.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/gmp_op.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/init.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/init2.Po
@@ -2236,7 +2252,7 @@ maintainer-clean: maintainer-clean-recursive
-rm -f @MPFR_TREE@/src/$(DEPDIR)/set_str.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/set_ui_2exp.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/set_z.Po
- -rm -f @MPFR_TREE@/src/$(DEPDIR)/set_z_exp.Po
+ -rm -f @MPFR_TREE@/src/$(DEPDIR)/set_z_2exp.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/set_zero.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/setmax.Po
-rm -f @MPFR_TREE@/src/$(DEPDIR)/setmin.Po
diff --git a/Build/source/libs/mpfr/TLpatches/ChangeLog b/Build/source/libs/mpfr/TLpatches/ChangeLog
index ac502b5c8b2..e87608ce671 100644
--- a/Build/source/libs/mpfr/TLpatches/ChangeLog
+++ b/Build/source/libs/mpfr/TLpatches/ChangeLog
@@ -1,3 +1,9 @@
+2023-01-12 Akira Kakuto <kakuto@jcom.zaq.ne.jp>
+
+ Imported mpfr-4.2.0 source tree from:
+ http://ftp.gnu.org/gnu/mpfr/
+ * patch-01-TL: Adapted.
+
2022-11-18 Akira Kakuto <kakuto@jcom.zaq.ne.jp>
Imported mpfr-4.1.1 source tree from:
diff --git a/Build/source/libs/mpfr/TLpatches/TL-Changes b/Build/source/libs/mpfr/TLpatches/TL-Changes
index dbf100875ba..210b5c8f9bf 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.1.1/ tree as obtained from:
+Changes applied to the mpfr-4.2.0/ 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 5504984a765..af4dfd9d71e 100644
--- a/Build/source/libs/mpfr/TLpatches/patch-01-TL
+++ b/Build/source/libs/mpfr/TLpatches/patch-01-TL
@@ -1,9 +1,9 @@
-diff -ur mpfr-4.1.1/src/mparam_h.in mpfr-src/src/mparam_h.in
---- mpfr-4.1.1/src/mparam_h.in Fri Jan 07 00:27:38 2022
-+++ mpfr-src/src/mparam_h.in Fri Nov 18 05:45:03 2022
-@@ -31,6 +31,8 @@
- /* Note: the different macros used here are those defined by gcc,
- for example with gcc -mtune=native -dM -E -xc /dev/null */
+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
+@@ -38,6 +38,8 @@
+ -march=... and -mtune=...).
+ See https://gcc.gnu.org/pipermail/gcc-help/2021-September/140720.html */
+#elif 1 /* no processor specific optimization for TeX Live */
+#define MPFR_TUNE_CASE "default"
diff --git a/Build/source/libs/mpfr/configure b/Build/source/libs/mpfr/configure
index 3e66e764294..027049f9cb5 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.1.1.
+# Generated by GNU Autoconf 2.71 for mpfr (TeX Live) 4.2.0.
#
# 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.1.1'
-PACKAGE_STRING='mpfr (TeX Live) 4.1.1'
+PACKAGE_VERSION='4.2.0'
+PACKAGE_STRING='mpfr (TeX Live) 4.2.0'
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.1.1 to adapt to many kinds of systems.
+\`configure' configures mpfr (TeX Live) 4.2.0 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.1.1:";;
+ short | recursive ) echo "Configuration of mpfr (TeX Live) 4.2.0:";;
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.1.1
+mpfr (TeX Live) configure 4.2.0
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.1.1, which was
+It was created by mpfr (TeX Live) $as_me 4.2.0, 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.1.1'
+ VERSION='4.2.0'
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.1.1, which was
+This file was extended by mpfr (TeX Live) $as_me 4.2.0, 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.1.1
+mpfr (TeX Live) config.status 4.2.0
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 acbb0a58e39..aa301f9d43e 100644
--- a/Build/source/libs/mpfr/mpfr-src/BUGS
+++ b/Build/source/libs/mpfr/mpfr-src/BUGS
@@ -1,4 +1,4 @@
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/ChangeLog b/Build/source/libs/mpfr/mpfr-src/ChangeLog
index 33358a546ad..4ee0900c2e2 100644
--- a/Build/source/libs/mpfr/mpfr-src/ChangeLog
+++ b/Build/source/libs/mpfr/mpfr-src/ChangeLog
@@ -1,15 +1,370 @@
-2022-11-17 Vincent Lefevre <vincent@vinc17.net>
+2023-01-06 Vincent Lefevre <vincent@vinc17.net>
- Updated version to 4.1.1.
+ Updated version to 4.2.0.
-2022-11-17 Vincent Lefevre <vincent@vinc17.net>
+2023-01-05 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/zeta.c] For s < 1/2, use mpfr_sinpi now that it is available.
+
+ This replaces the use of mpfr_sin with a multiplication by π and
+ resolves a potential (but very unlikely) underflow issue; a comment
+ is updated, with an explanation about that.
+
+2023-01-05 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated copyright notice for all the Makefile.am files.
+
+ To be similar to the other files, added:
+ * Contributed by the AriC and Caramba projects, INRIA.
+ * This file is part of the GNU MPFR Library.
+
+ (These Makefile.am files still have their special license.)
+
+2023-01-05 Vincent Lefevre <vincent@vinc17.net>
+
+ Copyright notice update: added 2023.
+
+ Command used:
+ perl -pi -e 's/ (\d{4}-)?(2022)(?= Free Software)/
+ " ".($1||"$2-").($2+1)/e' **/*(^/)
+ under zsh, reverting doc/texinfo.tex (copied from GNU Texinfo)
+ and the tools/mbench directory (not distributed with MPFR).
+ Removed 2022 from the example in the doc/README.dev file.
+
+2023-01-04 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/zeta.c] Updated a comment about mpfr_sinpi.
+
+ [doc/mpfr.texi] Updated the month.
+
+2022-12-17 Vincent Lefevre <vincent@vinc17.net>
+
+ [tools/mpfrlint] Updated the __gmp_ test.
+
+ * No longer exclude '^tests/tabort_defalloc': this is no longer needed
+ since commit 41bed90365fd1296cd05f49c813ab0a0b151a62e in 2017.
+ * Exclude a new comment.
+
+2022-12-15 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] Added a comment about a possible test failure.
+
+ In short, if the error is like
+ repl-vsnprintf.c:389: GNU MP assertion failed: len < total_width
+ this is a GMP (or MPIR) issue in __gmp_replacement_vsnprintf.
+
+ References:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00001.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00027.html
+ https://gmplib.org/list-archives/gmp-bugs/2022-October/005200.html
+
+2022-12-15 Vincent Lefevre <vincent@vinc17.net>
+
+ Documentation: update about requirements for building MPFR.
+
+ * doc/mpfr.texi: mentioned C++ compilers and the potential issue
+ with type punning via union.
+ * INSTALL: completed (0) to be similar to what doc/mpfr.texi says.
+
+2022-12-15 Vincent Lefevre <vincent@vinc17.net>
+
+ [tools/update-version] Fixed replacements in "INSTALL".
+
+ Due to commit 4885b57add174f390eff29abe14d12fb5ebd6a61, only the first
+ of the 4 replacements in INSTALL was done.
+
+2022-12-14 Vincent Lefevre <vincent@vinc17.net>
+
+ [configure.ac] Added a comment about a possible AM_PROG_AR failure.
+
+ The reason is that on some platforms, GMP chooses a non-default mode
+ (a.k.a. ABI). MPFR has some workaround thanks to GMP_CC and GMP_CFLAGS
+ provided by GMP, but this may not be sufficient, e.g. on power-aix. In
+ such a case, the user needs to either force GMP to use the default mode
+ or provide an AR variable for MPFR's configure; see INSTALL file.
+
+2022-12-13 Vincent Lefevre <vincent@vinc17.net>
+
+ ChangeLog update with tools/update-changelog
+
+ [doc/README.dev] "To make a release": update.
+
+ [NEWS] Update for the 4.2.0 release: binary compatibility.
+
+ [doc/README.dev] "To make a release": update about <branch>-root tag.
+
+ [README] Updated URL of the README.dev file (for the 4.2 branch).
+
+ Updated version to 4.2.0-rc1.
+
+ ChangeLog update with tools/update-changelog
+
+ [src/Makefile.am] Updated -version-info to 8:0:2 for MPFR 4.2.0.
+
+ [manual] Section "API Compatibility": lexicographic order.
+
+2022-12-13 Vincent Lefevre <vincent@vinc17.net>
+
+ [NEWS,doc/mpfr.texi] Clarification for mpfr_pown.
+
+ Note: Though implemented as a macro, it is mainly documented as a
+ function (not as a macro) because it cannot be distinguished from
+ a function (for instance, one can take the function pointer).
+
+2022-12-13 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tget_flt.c] Added a comment.
+
+2022-12-13 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/README.dev] Updated a pathname.
+
+ This should have been done with the source reorganization on 2010-08-17
+ (see commit a6c9580d75b967e0d121d606edf03515ada45a7a).
+
+2022-12-12 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated doc/texinfo.tex to 2022-12-10.11
+
+ The only change concerning MPFR is that in the PDF manual, the
+ section titles in the table of contents are now clickable.
+
+2022-12-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tstdint.c] Added missing conditional config.h inclusion.
+
+ The consequence of the missing inclusion is that on build systems that
+ need config.h (some MS Windows ones?), this test would be skipped.
+
+2022-12-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/README.dev] Clarification about the need of config.h inclusion.
+
+ [tests/tstdint.c] Updated comment.
+
+2022-12-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tstdint.c] Added a comment.
+
+ In short, this test allows one to detect that mpfr.h can be included
+ without any other inclusion before. For instance, it can detect any
+ unprotected use of FILE in the mpfr.h header file.
+
+2022-12-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Added comment about the update of the version string.
+
+2022-12-12 Vincent Lefevre <vincent@vinc17.net>
+
+ Revert "changed %.8e into %a to avoid potential decimal output bug"
+
+ This reverts commit e18ebe062042c01ad44b238df212f229bd251cd6.
+
+ We currently still support C90 (in particular, here this concerns
+ the C library of the platform).
+
+2022-12-12 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ changed %.8e into %a to avoid potential decimal output bug
+
+ (cf https://sympa.inria.fr/sympa/arc/mpfr/2022-12/msg00015.html)
+
+2022-12-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/mpfr-cvers.h] Added a comment about (major,minor) tests.
+
+2022-12-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/mpfr-test.h] Improved the change done a few hours earlier.
+
+ The code introduced by commit 558a246e612fa230623fb0dfa0570b1c626a103c
+ was changing the conditions under which IGNORE_CPP_COMPAT is defined
+ (to ignore -Wc++-compat with a GCC pragma). Let's simplify it by using
+ our __MPFR_GNUC() macro. The only possible change of behavior is that
+ this excludes Intel's compiler (which is probably better as testing
+ the GCC version on Intel's compiler doesn't make sense).
+
+ Note concerning the behavior of Intel icx 2021.3.0 under Linux: Before
+ the above commit, it was not excluded; but after this above commit, it
+ was excluded as it identifies itself as GCC 4.2.1 (like Clang). With
+ this new change, it is still excluded. Anyway, it ignores -Wc++-compat
+ and doesn't complain on the GCC pragmas, so the above choice currently
+ doesn't matter.
+
+2022-12-11 Vincent Lefevre <vincent@vinc17.net>
+
+ Avoid a testsuite build failure with GCC older than 4.6.
+
+ In tests/mpfr-test.h, we must not define IGNORE_CPP_COMPAT for
+ GCC < 4.6 as it does not allow "#pragma GCC diagnostic" inside
+ functions. Moreover, let's define it for all Clang versions,
+ including MS Windows (where __GNUC__ is not defined).
+
+ Changes based on information and a patch by Bruno Haible:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-12/msg00007.html
+
+2022-12-09 Vincent Lefevre <vincent@vinc17.net>
+
+ [autogen.sh] Improved comment about the INSTALL file.
+
+ [autogen.sh] Updated comment about the INSTALL file.
+
+2022-12-07 Vincent Lefevre <vincent@vinc17.net>
- [NEWS] Update for 4.1.1.
+ [Makefile.am] Corrected a note about version-ext.sh in EXTRA_DIST.
- Removed "by using a recent texinfo.tex file" because GNU Texinfo 7.0
- has been released in the mean time (we're actually using a slightly
- more recent version, but the current version of the MPFR manual has
- workarounds that do not need the latest fixes in texinfo.tex).
+ In short, since commit a6e9d69047a358bfd1aaa1418d9999b8abe0bb62,
+ version-ext.sh should no longer be needed in EXTRA_DIST because
+ it will no longer be executed. But since this script is small,
+ we distribute it just in case it would be used.
+
+2022-12-06 Vincent Lefevre <vincent@vinc17.net>
+
+ Fixed version-ext.sh usage, avoiding "make check" failure and incorrect
+ version information.
+
+ The use of version-ext.sh could be incorrect when the MPFR source tree
+ was in a Git working tree:
+ * "make check" could fail in some cases, see the bug report by
+ Trevor Spiteri:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-12/msg00000.html
+ * Version information output by "make check" could be incorrect.
+
+ Changes:
+ * tests/Makefile.am: For output_info, we now also check whether
+ $(top_srcdir)/.git is readable in order to avoid escaping the
+ MPFR source tree. In particular, if one extracts an MPFR tarball
+ within a Git working tree (e.g. after "make dist"), then running
+ "make check" in this extracted source tree will work as expected,
+ giving correct version information.
+ * tests/Makefile.am, version-ext.sh: Updated comments. In particular,
+ moved a comment from tests/Makefile.am to version-ext.sh; this should
+ have been done in commit 0d3abf10458ca4fdd26daa77a02f7f1f4e361deb,
+ i.e. when version-ext.sh was created.
+
+2022-12-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Removed useless leading spaces in examples.
+
+ All examples should have at least one line that does not have
+ leading spaces. Texinfo already indents examples in all cases.
+
+2022-12-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Removed useless single quotes in an example.
+
+ Texinfo changes these quotes to U+2019 RIGHT SINGLE QUOTATION MARK
+ with TeX output (PDF), and it is no part of ASCII, which might yield
+ issues in case of reuse in actual code. The subsequent example does
+ not use quotes, so let's do the same.
+
+2022-12-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+2022-12-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Added a FIXME about the @need issue.
+
+ Context:
+ https://lists.gnu.org/archive/html/bug-texinfo/2022-11/msg00228.html
+
+2022-11-30 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] 2 replacements of ASCII "-" by @minus{}.
+
+ Note: these should be the last remaining issues with the minus sign.
+
+2022-11-30 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] 3 replacements of ASCII "-" by @minus{}.
+
+2022-11-28 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/mpfr-impl.h] Added a comment for the umul_hi(h, x, y) macro.
+
+ Say that MPFR_NEED_LONGLONG_H needs to be defined to use it.
+
+ This macro is defined unconditionally (this is not an issue) because
+ MPFR_NEED_LONGLONG_H has been undefined earlier in mpfr-impl.h (why?),
+ so we can no longer test MPFR_NEED_LONGLONG_H.
+
+2022-11-28 Vincent Lefevre <vincent@vinc17.net>
+
+ Get rid of the _mulx_u64 intrinsic.
+
+ It was found that this intrinsic has issues with ICC, Cygwin, and more
+ generally, the Microsoft toolchain; even MPFR's strong detection at
+ configure time (an AC_RUN_IFELSE test) was not sufficient. Moreover,
+ _mulx_u64 is useless as umul_ppmm from mpfr-longlong.h does the same
+ thing from the spec point of view (and thus was used as the fallback).
+ So, if there is a reliable way to use the mulx instruction whenever
+ possible (including via compiler optimization and the use of __int128
+ when available, as done by GCC's _mulx_u64 implementation), this
+ should be done in the umul_ppmm definition. Alternatively, we could
+ redefine umul_ppmm for the use of __int128 when possible.
+
+ Context and references:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-11/msg00008.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-11/msg00027.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-11/msg00030.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-11/msg00031.html
+ https://stackoverflow.com/a/54815033/3782797
+
+ * src: corrected the umul_hi(h, x, y) macro (the only code that was
+ using _mulx_u64) and moved it from invert_limb.h and invsqrt_limb.h
+ to mpfr-impl.h.
+ * tests/tversion.c: removed the output info about _mulx_u64.
+ * acinclude.m4: removed the check for _mulx_u64.
+
+2022-11-25 Vincent Lefevre <vincent@vinc17.net>
+
+ [NEWS] Added release name for 4.2.0: "fondue savoyarde".
+
+ mpfr-longlong.h update from the current GMP development code.
+
+2022-11-24 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [doc/mini-gmp] updated svn revision to git revision
+ [tools/bench/README] likewise
+
+2022-11-23 Vincent Lefevre <vincent@vinc17.net>
+
+ [tools/build-patch] Update for patches generated by git.
+
+ Such patches are of the form
+ --- a/path/name
+ +++ b/path/name
+ so with need to use the -p1 patch option if the --- line
+ starts with "--- a/".
+
+2022-11-23 Vincent Lefevre <vincent@vinc17.net>
+
+ [tools/build-patch] Updated a comment for Git.
+
+2022-11-22 Vincent Lefevre <vincent@vinc17.net>
+
+ Fix mpfr_custom_get_kind() macro bug.
+
+ * src/mpfr.h: in the mpfr_custom_get_kind() macro, changed mpfr_ptr to
+ mpfr_srcptr for _x to agree with the function prototype, in order to
+ avoid a compilation failure of user code in some cases. This bug was
+ introduced by commit 9f94e0311ed53d0c64d4fbca249d19cc4888027e, which
+ introduced the temporary variable _x to avoid an incorrect number of
+ evaluations of the x argument.
+ * tests/tstckintc.c: improved the tests to detect this bug.
+
+ This should fix mpfr bug #1.
+
+ Bug initially reported by FX Coudert:
+ https://github.com/CGAL/cgal/issues/7064
+
+ It affects Fedora Linux:
+ https://bugzilla.redhat.com/show_bug.cgi?id=2144197
+
+2022-11-17 Vincent Lefevre <vincent@vinc17.net>
+
+ ChangeLog update with tools/update-changelog
2022-11-17 Vincent Lefevre <vincent@vinc17.net>
@@ -60,10 +415,10 @@
2022-11-16 Vincent Lefevre <vincent@vinc17.net>
- Updated version to 4.1.1-rc1 again with the new tools/update-version.
+ Updated version to 4.2.0-dev with the new tools/update-version.
All the expected replacements have now *really* been done thanks to
- commit 9f1d88a7ab750a9f33ff5c7f6b27bc2e941ca4b6.
+ commit a4dec8938b85afbca2d448ae2dd4e0d3ab72b00c.
2022-11-16 Vincent Lefevre <vincent@vinc17.net>
@@ -81,28 +436,22 @@
Updated doc/texinfo.tex to 2022-11-13.08
-2022-11-11 Vincent Lefevre <vincent@vinc17.net>
+ [TODO] Added URL for the Clang multiprecision arithmetic builtins.
- [doc/README.dev] Updated "To make a release".
+2022-11-15 Paul Zimmermann <Paul.Zimmermann@inria.fr>
- [doc/README.dev] "To make a release": mention the README file.
+ [TODO] add reference to __builtin_addcll
2022-11-11 Vincent Lefevre <vincent@vinc17.net>
- [README] Changed link to the README.dev file to the 4.1 branch.
-
- It is probably better to give the link in the 4.1 branch, since
- we are in the 4.1 branch: some changes in master may not apply
- to the 4.1 branch (for instance, the list of macros and the list
- of environment variables that affect the tests). Future changes
- useful for the 4.1 branch could be cherry-picked if need be.
+ [doc/README.dev] "To make a release": mention the README file.
2022-11-10 Vincent Lefevre <vincent@vinc17.net>
- Updated version to 4.1.1-rc1 again with the new tools/update-version.
+ Updated version to 4.2.0-dev with the new tools/update-version.
All the expected replacements have now been done in doc/mpfr.texi,
- thanks to commit 9645c5255492c6d00133a3a90e479d374b6c061d.
+ thanks to commit 7eda345244f503359d14cd5bae1ed42865d39ee8.
2022-11-10 Vincent Lefevre <vincent@vinc17.net>
@@ -133,81 +482,224 @@
2022-11-08 Vincent Lefevre <vincent@vinc17.net>
- [doc/mpfr.texi] Various corrections and improvements.
+ [doc/mpfr.texi] Updated comment about an issue with math operators.
- * mpfr_subnormalize: define EXP(x) and PREC(x).
- * More typographic corrections and improvements.
+ [doc/mpfr.texi] Added a comment about an issue with math operators.
-2022-11-07 Vincent Lefevre <vincent@vinc17.net>
+ [doc/mpfr.texi] Another typographic improvement.
- [doc/mpfr.texi] Added a comment (ref to the GNU Texinfo spacing bug).
+2022-11-08 Vincent Lefevre <vincent@vinc17.net>
-2022-11-07 Vincent Lefevre <vincent@vinc17.net>
+ [doc/mpfr.texi] Added a comment for \mathop with a single character.
+
+ Workaround to avoid an alignment issue described at
+ https://tex.stackexchange.com/questions/41261/mathop-shifts-the-baseline-declaremathoperator-doesnt
+ when the math operator @EXP{} was just "E".
- [doc/mpfr.texi] Remaining typographic correction for a math expression.
+2022-11-08 Vincent Lefevre <vincent@vinc17.net>
- This is specific to the 4.1 branch as the text was removed in master
- with the new function mpfr_rootn_si.
+ [doc/mpfr.texi] More typographic corrections and improvements.
+
+ Also did some changes to improve the consistency.
+
+2022-11-07 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Added a comment (ref to the GNU Texinfo spacing bug).
2022-11-07 Vincent Lefevre <vincent@vinc17.net>
- [doc/mpfr.texi] Typographic corrections and English usage.
+ [doc/mpfr.texi] More typographic corrections for math expressions.
- * More documentation for the @m{T,N} macro.
* Note a spacing bug in texi2dvi from GNU Texinfo 6.8 with macros
(found while testing).
* Define macro @EXP (and \EXP in TeX).
- * Typographic corrections for math expressions and English usage.
+ * Typographic corrections for math expressions.
-2022-11-04 Vincent Lefevre <vincent@vinc17.net>
+2022-11-07 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Added a comment.
- [doc/mpfr.texi] Minor typographic correction.
+ [doc/mpfr.texi] Improved typography and English usage.
- This corrects commit d1a6e781428506bc49bc98d632265cf2d4406c9f.
+ [doc/mpfr.texi] More documentation for the @m{T,N} macro.
2022-11-04 Vincent Lefevre <vincent@vinc17.net>
- [doc/mpfr.texi] Updated the month.
+ [src/set_zero.c] IEEE 754 terminology in a comment.
2022-11-04 Vincent Lefevre <vincent@vinc17.net>
- [doc/mpfr.texi] Various improvements and style corrections from master.
+ [doc/mpfr.texi] Improved consistency about infinity and zero.
- with conflict resolutions.
+ Note: one writes "+0", but "positive zero", not "plus zero", etc.
+ See the IEEE 754 standard.
2022-11-03 Vincent Lefevre <vincent@vinc17.net>
- [manual] For sqrt, mention the relation with rootn.
+ [doc/mpfr.texi] Minor corrections related to infinity.
- This corresponds to commit a9bdb273b79ae470ad2177c27e7e978f4bc9831e
- from master, ignoring mpfr_rootn_si, which is not in the 4.1 branch.
+ This completes commit 75041697429ba467c448195b4f0863d0eb92e20c
+ done in 2021-02.
2022-11-03 Vincent Lefevre <vincent@vinc17.net>
- Fixed some minor mistakes.
+ [doc/mpfr.texi] Style corrections.
- * Minor mistakes in doc/mpfr.texi reported by Ivan Panchenko:
- https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00020.html
- (spacing and italicization not fixed yet).
- * Fixed similar mistakes in the other files.
-
-2022-11-03 Vincent Lefèvre <vincent@vinc17.net>
+2022-11-03 Vincent Lefevre <vincent@vinc17.net>
- [doc] Update about "case insensitive" and issue with Turkish locales
- for "I" / "i".
+ [doc/mpfr.texi] Style improvement for TeX (PDF) output.
- * mpfr.texi: added "with the rules of the C locale" in the
- mpfr_strtofr description.
- * README.dev: completed information about Turkish locales.
+ For mpfr_acosu, mpfr_asinu, mpfr_atanu and mpfr_atan2u, make the style
+ similar to the one for mpfr_cosu, mpfr_sinu and mpfr_tanu.
2022-11-03 Vincent Lefevre <vincent@vinc17.net>
+ [doc/mpfr.texi] More use of @tm (typographic corrections).
+
+2022-11-01 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+ [doc/mpfr.texi] Completed the description of the @mm macro.
+
+2022-11-01 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Improved typography for the formatted output functions.
+
+ For what is displayed (or output text), @samp{...} should be used,
+ as already done in some cases (note: never enclose @samp{...} with
+ quotes as this is already done in the Texinfo processing).
+
+2022-11-01 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Improved the readability of an example.
+
+2022-11-01 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] More typographic corrections for TeX (PDF) output.
+
+ * Define a @mm{T} macro to be used for math symbols outside of @m,
+ @tm, @code or similar (but not for the "+" in "C++").
+ * Use this macro when applicable.
+ * Add missing @tm for some simple math expressions.
+
+2022-10-28 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Added tm macro and improved math typography.
+
+2022-10-27 Vincent Lefevre <vincent@vinc17.net>
+
+ [tools/nightly-test] Corrections and cleanup.
+
+ In particular, reverted most changes done in SVN r9832
+ (commit 1ca64e34907c5a968ca7fcc3d22cdca2ede7f28b):
+ * switch back to /bin/sh (bash is not needed by this script);
+ * do not use --enable-decimal-float and --enable-float128 with
+ a C++ compiler as they are not supported (configure fails).
+
+ And for the "git clone" command:
+ * take the BRANCH argument into account;
+ * use --depth 1 to avoid an unnecessary full clone.
+
+ Better g++ detection (e.g. g++-12 or /usr/bin/g++, not just g++).
+
+2022-10-27 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tools/nightly-test] change to git
+
+2022-10-26 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Cosmetic consistency change in the .texi source.
+
+ Let's use the same code for "start of header" and "end of header".
+
+2022-10-25 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated @m{T,N} macro, with comments.
+
+ The @m{T,N} macro is used for math formatting and textual equivalent
+ (human-readable text). However, it was generating emphasis in HTML,
+ which was unexpected. This commit removes the use of @math for the
+ Info and HTML output (for Info, this does not change anything, and
+ for HTML, this removes the incorrect emphasis). It also updates the
+ documentation and adds a comment about the history of this macro and
+ various issues related to it.
+
+2022-10-24 Vincent Lefevre <vincent@vinc17.net>
+
Updated doc/texinfo.tex to 2022-10-18.18
Update from the texinfo Git repository.
* The generated mpfr.html and mpfr.info files remain the same.
* For mpfr.pdf, there are some spacing improvements.
+2022-10-11 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+2022-10-11 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Fix formatting for mpfr_can_round.
+
+ Consistency changes and use of no-break space (@tie{}).
+
+ Note: Once @math{...} has been clarified/fixed, apply the suggestions
+ by Ivan Panchenko:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00020.html
+
+2022-10-11 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Consistency correction for mpfr_get_str_ndigits.
+
+ Use @math{m} (instead of just m) as already used a bit earlier.
+
+ But the use of @math may need to be revised. See
+ https://lists.gnu.org/archive/html/bug-texinfo/2022-10/msg00045.html
+
+2022-10-11 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Improved spacing.
+
+ 2 changes suggested by Ivan Panchenko at
+
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00020.html
+
+ but do not use @math{...} as with HTML output, it puts everything
+ in italics with <em class='math'>...</em>, which is incorrect for
+ things like digits.
+
+ However, this behavior of @math{...} is not what is documented in
+ the GNU Texinfo 6.8 manual, which says:
+
+ The '@math' command has no special effect on the Info output or (by
+ default) the HTML output, merely outputting the contents verbatim.
+
+2022-10-11 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Added a comment about the use of @math{...}.
+
+2022-10-11 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Fixed italicization for mpfr_eint.
+
+ An issue reported by Ivan Panchenko:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00020.html
+
+ I also had to fix the occurrences of k in @ifnottex for HTML.
+
+2022-10-11 Vincent Lefevre <vincent@vinc17.net>
+
+ Fixed some minor mistakes.
+
+ * Minor mistakes in doc/mpfr.texi reported by Ivan Panchenko:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-10/msg00020.html
+ (spacing and italicization not fixed yet).
+ * Fixed similar mistakes in the other files.
+
+2022-10-11 Vincent Lefevre <vincent@vinc17.net>
+
+ mpfrlint: updated text checking (spelling...)
+
2022-10-05 Vincent Lefevre <vincent@vinc17.net>
ChangeLog update with tools/update-changelog
@@ -223,14 +715,12 @@
2022-10-05 Vincent Lefevre <vincent@vinc17.net>
- [doc/README.dev] "To make a release": corrections about the tag.
+ [doc/README.dev] "To make a release": precision about the tag.
- ChangeLog update with tools/update-changelog
+ [doc/README.dev] "To make a release": correction about the tag.
[tests/tnrandom.c] Fixed compilation failure with mini-gmp.
- ChangeLog update with tools/update-changelog
-
2022-10-05 Vincent Lefevre <vincent@vinc17.net>
[tools] Improvement for the ChangeLog generation.
@@ -271,8 +761,6 @@
2022-10-05 Vincent Lefevre <vincent@vinc17.net>
- Corrected comment about the ".POSIX" line in all Makefile.am files.
-
[doc/README.dev] "To make a release": update for abi-compliance-checker.
2022-10-05 Vincent Lefevre <vincent@vinc17.net>
@@ -300,7 +788,7 @@
[tests/tnrandom.c] Support non-default seed (GMP_CHECK_RANDOMIZE).
- This fixes a failure due to 98014bfa2e453dd96dece493a88f983f111fc6a3
+ This fixes a failure due to 4c5973c2f0153a3a4708cab79ed142e72c4a50eb
when GMP_CHECK_RANDOMIZE is set.
2022-10-04 Vincent Lefevre <vincent@vinc17.net>
@@ -309,19 +797,15 @@
2022-10-03 Vincent Lefevre <vincent@vinc17.net>
- [doc] Updated FAQ.html with update-faq.
-
[doc/update-faq] Ensure that the code is run from the doc directory.
[tools/coverage] Typo.
[doc/README.dev] Updated "To make a release".
- [NEWS] Update for 4.1.1.
-
- doc/mpfr.texi: Updated the month.
+ Updated URLs.
- Updated version to 4.1.1-rc1 (with tools/update-version).
+ Updated URLs.
Updated URLs.
@@ -332,7 +816,7 @@
The addition of the <branch>-root tag applies only after a branch
is created, i.e. for non-patchlevel releases (item 0).
-2022-09-18 Vincent Lefevre <vincent@vinc17.net>
+2022-09-14 Vincent Lefevre <vincent@vinc17.net>
Updated doc/texinfo.tex to 2022-09-14.01
@@ -340,6 +824,12 @@
* The generated mpfr.html and mpfr.info files remain the same.
* For mpfr.pdf, this version fixes all the issues I've reported.
+2022-09-09 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/README.dev] Updated "To make a release".
+
+ [src/mpfr-impl.h] Added TODO for MPFR_MAYBE_UNUSED.
+
2022-09-07 Vincent Lefevre <vincent@vinc17.net>
[doc/README.dev] New C2x draft (N3054).
@@ -358,49 +848,196 @@
and the svn:ignore property should have been updated at this time,
but I forgot.
+2022-09-03 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/RRTest.c] Replaced "egrep" by "grep -E" in comment.
+
+ In the GNU grep 3.8 release notes:
+ The egrep and fgrep commands, which have been deprecated since
+ release 2.5.3 (2007), now warn that they are obsolescent and should
+ be replaced by grep -E and grep -F.
+
2022-08-27 Vincent Lefevre <vincent@vinc17.net>
[doc/README.dev] Changed "trunk" (Subversion) to "master" (Git).
-2022-08-27 Vincent Lefevre <vincent@vinc17.net>
+ [doc/README.dev] New C2x draft (N3047).
- [doc/README.dev] Update from master, minus a few things.
+2022-08-26 Vincent Lefevre <vincent@vinc17.net>
- From the master version, removed
- * text that do not apply to the 4.1 branch;
- * an obsolete URL.
+ [tools/announce-text] Updated key ID for the future releases.
-2022-08-27 Vincent Lefevre <vincent@vinc17.net>
+2022-08-19 Vincent Lefevre <vincent@vinc17.net>
- Added m4/ax_pthread.m4 file, and related updates.
+ [codespell.ignore] Ignore RO and SIZ (codespell 2.2.0).
- This adds m4/ax_pthread.m4 from master and changes the following files:
- * acinclude.m4: updated comment; set CXX and CXXFLAGS.
- * configure.ac: moved AC_CANONICAL_HOST earlier and added a comment
- (this was needed with an intermediate version of ax_pthread.m4,
- but this change is kept as this should be better).
- * doc/README.dev: update about the AX_PTHREAD macro.
+ Corrected spelling mistake found by codespell 2.2.0
-2022-08-27 Vincent Lefevre <vincent@vinc17.net>
+2022-08-16 Vincent Lefevre <vincent@vinc17.net>
+
+ Cleanup about decimal floating constants matching ".0d".
+
+ In general, the trailing 0 is not needed, and even not wanted
+ (this has the effect to decrease the quantum by 1 compared to the
+ "natural value"), though the quantum is not yet specified in MPFR.
+
+ In tests/tget_set_d64.c, kept this trailing 0 in mpfr_set_decimal64,
+ but added similar tests without this trailing 0.
+
+2022-08-08 Vincent Lefevre <vincent@vinc17.net>
+
+ version-ext.sh: replaced a remaining "sed" by "$SED".
+
+ Thanks to Trevor Spiteri for noticing that.
+
+2022-08-08 Vincent Lefevre <vincent@vinc17.net>
+
+ version-ext.sh: handle the case where no Git branches are found.
+
+ This should solve the issue reported on 2022-08-08 by Trevor Spiteri:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-08/msg00002.html
+
+2022-07-08 Vincent Lefevre <vincent@vinc17.net>
+
+ doc/mpfr.texi: Updated the month.
+
+2022-07-08 Vincent Lefevre <vincent@vinc17.net>
- Added tools/export-release sh script from master.
+ [manual] Added a note for mpfr_nexttoward (exceptions, sign of 0).
+
+ Also applies to mpfr_nextabove and mpfr_nextbelow, whose description
+ refers to mpfr_nexttoward.
+
+ See additional details in the comment in the src/next.c source.
+
+2022-07-08 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/next.c] Updated comment (exceptions and sign of 0).
+
+ Concerned functions: mpfr_nexttoward, mpfr_nextabove, mpfr_nextbelow.
+
+ Clarification was needed due to the differences between the
+ IEEE 754-1985, IEEE 754-2008/2019 and ISO C99+ standards on
+ similar functions (nextafter, nextUp, nextDown).
+
+2022-07-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [configure.ac] Update about GNU gold ld and LD_RUN_PATH.
+
+ * Comment update: added URL of the upstream bug report.
+ * Mention the GNU gold linker in the warning.
+
+2022-06-13 Vincent Lefevre <vincent@vinc17.net>
+
+ [README] Replaced "Subversion" by "Git".
+
+ [doc/README.dev] Completed the update for Git.
+
+ [doc/README.dev] Moved and clarified a paragraph about the tests.
+
+2022-06-11 Vincent Lefevre <vincent@vinc17.net>
+
+ Fixed tsprintf %a tests when GMP and libc produce different outputs.
+
+ With some 32-bit mingw-w64 implementations, the GMP and libc
+ formatted output functions produce different outputs for %a (this
+ is not completely specified by the C standard). In the MPFR tests
+ introduced by commit 22db634294c27eabbc0c55b04267d3ab5bc9a648 on
+ 2022-05-19, the comparison is done between the MPFR result, which
+ is based on GMP, and the libc result; hence a failure.
+
+ So, changed the 4 concerned tests of tests/tsprintf.c to compare
+ the MPFR result with the GMP result (for the other tests on the
+ C native types, it is still better to compare MPFR with libc).
+
+ Bug report:
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-06/msg00004.html
+
+2022-06-10 Vincent Lefevre <vincent@vinc17.net>
+
+ [tools/announce-text] Completed the update for Git.
+
+ [tools/announce-text] Check that one has an annotated tag at origin.
+
+ [tools/announce-text] Update.
+
+ [tools/announce-text] Minor git-related simplification.
+
+ [tools/announce-text] Started the update for Git.
+
+ [tools/announce-text] Removed code and text related to InriaForge (obsolete).
+
+2022-06-08 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated www.open-std.org URLs: http → https.
+
+2022-06-07 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/README.dev] New C2x draft (N2912).
+
+2022-06-02 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/README.dev] Updated "To make a release".
+
+ This completes the update for Git and Inria GitLab. But the
+ tools/announce-text script has not been updated yet.
+
+2022-06-02 Vincent Lefevre <vincent@vinc17.net>
+
+ [tools/export-release] Completed the script.
+
+ Fix the timestamps so that each file or directory has a timestamp
+ corresponding to its last change.
+
+2022-06-02 Vincent Lefevre <vincent@vinc17.net>
+
+ Added tools/export-release sh script.
Export some release identified by a Git tag in order to get a tarball.
-2022-08-27 Vincent Lefevre <vincent@vinc17.net>
+2022-06-02 Vincent Lefevre <vincent@vinc17.net>
+
+ [mbench] Updated Copyright lines.
+
+ Added tools/mbench/.gitignore file.
+
+ [mbench/Makefile] Added missing dependencies on timp.h
+
+2022-06-02 Vincent Lefevre <vincent@vinc17.net>
+
+ [mbench/timp.h] Bug fix for "make rt" on 32-bit machines. Reindent.
+
+ For the code used when USE_CLOCK_MONOTONIC is defined ("make rt"):
+ If both time_t (type of tv_sec) and long are 32-bit types, there was
+ an overflow in the timp_rdtsc() macro, due to the multiplication of
+ the tv_sec (coming from CLOCK_MONOTONIC, thus typically larger than 5)
+ by the value 1000000000 (≈ 2^32 / 4.3) of type unsigned long, because
+ this multiplication would be done on 32 bits. Changed the type of the
+ constant to unsigned long long so that the operations are done with
+ the target type unsigned long long (at least).
+
+2022-06-02 Vincent Lefevre <vincent@vinc17.net>
+
+ [mbench] Removed trailing whitespace.
+
+2022-06-01 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/README.dev] Updated "To make a release" (about ChangeLog).
+
+ ChangeLog update with "make ChangeLog"
[tools/ck-copyright-notice] Better indentation.
[tools/ck-copyright-notice] Support the future ChangeLog format.
-2022-08-27 Vincent Lefevre <vincent@vinc17.net>
+2022-06-01 Vincent Lefevre <vincent@vinc17.net>
[tools/ck-copyright-notice] Better error handling.
Note: One currently gets a failure with the future ChangeLog format,
obtained with gitlog-to-changelog (via "make ChangeLog").
-2022-08-27 Vincent Lefevre <vincent@vinc17.net>
+2022-06-01 Vincent Lefevre <vincent@vinc17.net>
Support ChangeLog regeneration from a Git working tree.
@@ -416,116 +1053,161 @@
Note: In the future, if there is any change to do to a Git commit
message (typo, etc.), the --amend option could be used.
-2022-08-27 Vincent Lefevre <vincent@vinc17.net>
+2022-05-30 Vincent Lefevre <vincent@vinc17.net>
- [tools/announce-text] Update from master.
+ Started to update doc/README.dev for Git.
-2022-08-27 Vincent Lefèvre <vincent@vinc17.net>
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
- With wget, use the --no-config option.
+ [manual] Clarify the description of the formatted output functions.
- [INSTALL,doc/update-faq,tools/announce-text] With wget, use
- the --no-config option as the user's .wgetrc file may significantly
- change the behavior and possibly yield errors. See discussion at
- <https://lists.debian.org/debian-user/2021/01/msg01021.html>.
+ Emphasize the fact that the conv specifier F is not supported, except
+ for the type specifier R (for mpfr_t arguments).
-2022-08-23 Vincent Lefevre <vincent@vinc17.net>
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
- [codespell.ignore] Ignore RO and SIZ (codespell 2.2.0).
+ [src/vasprintf.c] Consistency with the non-support of %F by GMP.
- Corrected spelling mistake found by codespell 2.2.0
+ The F conversion specifier as defined by the C standard is not
+ supported by the GMP formatted output functions because it is
+ already used as the type specifier for mpf_t (which comes before
+ the conversion specifier). Let's take this fact into account.
- doc/mpfr.texi: Updated the month.
+ Note: this conversion specifier is still allowed with MPFR numbers
+ (e.g., "%RF") to avoid breaking the compatibility (it has never
+ been an issue).
-2022-08-08 Vincent Lefevre <vincent@vinc17.net>
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
- version-ext.sh: replaced a remaining "sed" by "$SED".
+ [tests/tsprintf.c] native_types: added tests to differentiate %G from %g.
- Thanks to Trevor Spiteri for noticing that.
+ The tested value -1.25 had the same output -1.25 with %g and %G.
+ Added 7.62939453125e-6 (= 2^(-17)), whose output by %g and %G has
+ an exponent introduced by 'e' and 'E' respectively.
-2022-08-08 Vincent Lefevre <vincent@vinc17.net>
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
- version-ext.sh: handle the case where no Git branches are found.
+ [tests/tsprintf.c] native_types: added tests for %a, %A, %la, %lA
- This should solve the issue reported on 2022-08-08 by Trevor Spiteri:
- https://sympa.inria.fr/sympa/arc/mpfr/2022-08/msg00002.html
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
-2022-08-08 Vincent Lefevre <vincent@vinc17.net>
+ [tests/tsprintf.c] Added/fixed native_types tests.
- For version-ext.sh, use "$SED" instead of "sed".
+ * Added tests of %E and %G.
+ * Removed the test of %lF, which is not supported by GMP (and yields
+ a heap buffer overflow, detected by AddressSanitizer): even though
+ there would be no ambiguity in this particular case, it is not
+ supported because the standard F conversion specifier isn't due to
+ the use of the F type specifier for mpf_t.
- * tests/Makefile.am: pass $SED to version-ext.sh.
- * version-ext.sh: use $SED (default to "sed").
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
-2022-08-08 Vincent Lefevre <vincent@vinc17.net>
+ [tests/tsprintf.c] Correction for %la, %lA, %le, %lE, %lf, %lF, %lg, %lG
- Fixed version-ext.sh when in an origin/* remote branch.
+ Reverted commit 2b60707d22717e0f582be5de680d7fa7004e2512 and added
+ tests for the missing %lE, %lF, %lG in native_types, protected by
+ a #if (see commit ecd3279f3dfd281fc8e51aac7509b76b27497a6c) as they
+ may need an ISO C99 compiler.
-2022-07-06 Vincent Lefevre <vincent@vinc17.net>
+ Note: The test of %la and %lA was incorrect because the first digit
+ is unspecified (and really depends on the C library). A test could
+ be added in the future, perhaps also with a configure test, because
+ the compiler may support ISO C99 but not the C library (there was
+ an issue like that at least with old versions of Solaris).
- [configure.ac] Update about GNU gold ld and LD_RUN_PATH.
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
- * Comment update: added URL of the upstream bug report.
- * Mention the GNU gold linker in the warning.
+ [tests/tsprintf.c] native_types: test %le, %lf, %lg only with C99+
-2022-07-06 Vincent Lefèvre <vincent@vinc17.net>
+ … since the l length modifier for the FP types (a, A, e, E, f, F, g, G
+ conversion specifiers) has been added in ISO C99.
- Punctuation (missing comma after "however").
+2022-05-19 Paul Zimmermann <Paul.Zimmermann@inria.fr>
-2022-06-13 Vincent Lefevre <vincent@vinc17.net>
+ [tests/tsprintf.c] added tests for %la, %lA, %le, %lE, %lf, %lF, %lg, %lG
- [README] Replaced "Subversion" by "Git".
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
-2022-06-11 Vincent Lefevre <vincent@vinc17.net>
+ [src/vasprintf.c] Bug fix for the l length modifier with FP type.
- Fixed tsprintf %a tests when GMP and libc produce different outputs.
+ The l length modifier is now supported with the a, A, e, E, f, F, g, G
+ conversion specifiers, as required by the ISO C standard on printf and
+ other formatted output functions. As specified, it is just ignored.
- With some 32-bit mingw-w64 implementations, the GMP and libc
- formatted output functions produce different outputs for %a (this
- is not completely specified by the C standard). In the MPFR tests
- introduced by commit 26fa003bc51fd75c180b7bca8070d66ceb53da62 on
- 2022-05-20, the comparison is done between the MPFR result, which
- is based on GMP, and the libc result; hence a failure.
+ For that, to improve code maintainability, the CASE_LONG_ARG() macro
+ was simplified:
+ * The c and s conversion specifiers are always supported by this
+ macro (this is a potential fix for implementations with incomplete
+ wide-character handling, without any guarantee to work).
+ * A MPFR_RET_NEVER_GO_HERE() for unsupported conversion specifiers
+ has been added (if specinfo_is_valid() is consistent with this
+ macro, one should effectively never reach this case).
- So, changed the 4 concerned tests of tests/tsprintf.c to compare
- the MPFR result with the GMP result (for the other tests on the
- C native types, it is still better to compare MPFR with libc).
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
- Bug report:
- https://sympa.inria.fr/sympa/arc/mpfr/2022-06/msg00004.html
+ [src/vasprintf.c] Made case ordering consistent (no change of behavior).
-2022-05-20 Vincent Lefevre <vincent@vinc17.net>
-
- Fixes related to the native types in the formatted output functions.
-
- * doc/mpfr.texi: clarification for the formatted output functions.
- * src/vasprintf.c:
- - Made case ordering consistent (no change of behavior).
- - The l length modifier is now supported with the native FP types
- (a, A, e, E, f, g, G conversion specifiers), as required by the
- ISO C standard on printf and other formatted output functions.
- As specified, it is just ignored.
- For that, to improve code maintainability, the CASE_LONG_ARG()
- macro was simplified: The c and s conversion specifiers are
- always supported by this macro (this is a potential fix for
- implementations with incomplete wide-character handling,
- without any guarantee to work). A MPFR_RET_NEVER_GO_HERE()
- for unsupported conversion specifiers has been added (as
- specinfo_is_valid() is consistent with this macro, one should
- effectively never reach this case).
- - The F conversion specifier as defined by the C standard is not
- supported by the GMP formatted output functions because it is
- already used as the type specifier for mpf_t (which comes before
- the conversion specifier). Let's take this fact into account.
- Note: this conversion specifier is still allowed with MPFR numbers
- (e.g., "%RF") to avoid breaking the compatibility (it has never
- been an issue).
- * tests/tsprintf.c: added related tests.
+ The "case" ordering in specinfo_is_valid() and in CONSUME_VA_ARG() for
+ integer specifiers and for floating-point specifiers was not the same.
+ Improved code readability by using the same order across the code
+ (also OK with CASE_LONG_ARG()).
2022-05-19 Vincent Lefevre <vincent@vinc17.net>
+ [tests/tsprintf.c] native_types: test %le, %lf, %lg.
+
+ These tests are currently failing. Bug reported by Paul Zimmermann
+ for %la (but %a and %la are not currently tested, because of their
+ possible lack of support in the C library).
+
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsprintf.c] native_types: same tests for i as for d.
+
[tests/tnrandom.c] With mini-gmp, disable the tests that check the values.
+ [acinclude.m4] Added a comment about the unreliable NAN != NAN check.
+
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/cmp_str.c] In mpfr_cmp_str, check that s is a valid number.
+
+ In the tests, the string provided to mpfr_cmp_str is normally a
+ valid number (the common use is to check that a result is equal to
+ some hardcoded value given by a string). A string s that does not
+ represent a valid number probably has a typo, and the consequence
+ was that in such a case, any non-NaN result was regarded as correct.
+
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsubnormal.c] Removed invalid testcase bug20220518.
+
+ The testcase bug20220518 added in
+ commit 7640a832fbf0b7f9057889e076cf7f42fe4f8e58
+ was invalid as the mpfr_subnormalize input was not in the current
+ exponent range (it had exponent -1074 while emin = -1073).
+
+ As usual, inputs outside the current exponent range are not supported
+ (the mpfr_subnormalize description in the manual is explicit:
+ "The subnormal exponent range is from ‘emin’ to ‘emin+PREC(X)-1’.").
+ Supporting values outside the current exponent range is not needed
+ in practice (see examples in the manual).
+
+2022-05-19 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tsubnormal.c] Code style in coverage().
+
+ [tests/tsubnormal.c] Added missing cleanup at the end of bug20220518.
+
+ [tests/tsubnormal.c] Simplified bug20220518.
+
+ [tests/tsubnormal.c] C90 compatibility.
+
+2022-05-18 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tsubnormal.c] added test case that exhibits a bug in mpfr_subnormalize
+ [src/subnormal.c] fixed typo
+
2022-05-18 Vincent Lefevre <vincent@vinc17.net>
[tests/tnrandom.c] Check some mpfr_nrandom values to detect changes.
@@ -533,11 +1215,57 @@
The values should be the same on different machines and with
different MPFR versions (or this would be an ABI change).
+2022-05-17 Vincent Lefevre <vincent@vinc17.net>
+
+ For version-ext.sh, use "$SED" instead of "sed".
+
+ * tests/Makefile.am: pass $SED to version-ext.sh.
+ * version-ext.sh: use $SED (default to "sed").
+
+2022-05-17 Vincent Lefevre <vincent@vinc17.net>
+
+ Fixed version-ext.sh when in an origin/* remote branch.
+
+2022-05-13 Vincent Lefevre <vincent@vinc17.net>
+
+ Tests: the check of subnormal support is done when running the tests.
+
+ The check of support for double and float subnormals was done at
+ configure time, but it could not be done when cross-compiling.
+ Since it is useful only for the tests, it is better to do it when
+ running the tests.
+
+ * tests/tests.c: added have_subnorm_dbl() and have_subnorm_flt()
+ functions to check support for double and float subnormals;
+ removed such a check from mpfr_test_init().
+ * tests/mpfr-test.h: declare these functions.
+ * tests/tget_flt.c: use have_subnorm_flt() instead of HAVE_SUBNORM_FLT.
+ * tests/tset_d.c, tests/tsprintf.c: removed the useless test of
+ HAVE_SUBNORM_DBL (this was a minor optimization).
+ * acinclude.m4: updated comment about the check of subnormal support;
+ minor improvement in the check for float subnormals.
+ Note: keep the check just for build information (it might be useful
+ for debugging or in case of a related bug report).
+ * tools/mpfrlint: check that the HAVE_SUBNORM_* macros are not used.
+
+2022-05-13 Vincent Lefevre <vincent@vinc17.net>
+
+ [acinclude.m4] Updated comment about the check of subnormal numbers.
+
+ * Removed text about DBL_HAS_SUBNORM and FLT_HAS_SUBNORM (which
+ was added in commit 3ee30bcf34bfb5d042e5a1aa9b7cf8a42b51cb91
+ on 2019-10-01) since these macros should be made obsolescent:
+ https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2981.htm
+ And their use would be incorrect in C++ (different meaning):
+ https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2988.pdf
+ * A bit more details.
+ * Added a FIXME for better cross-compiling support.
+
2022-05-10 Vincent Lefevre <vincent@vinc17.net>
doc/mpfr.texi: Updated the month.
- [NEWS] Update.
+ [NEWS] Mention the fixes of the macros of the custom interface.
2022-05-10 Vincent Lefevre <vincent@vinc17.net>
@@ -558,6 +1286,59 @@
in Section "API Compatibility" (also removed an obsolete comment
about that from src/mpfr.h).
+2022-05-08 Vincent Lefevre <vincent@vinc17.net>
+
+ Improved a comment.
+
+2022-05-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/README.dev] Added text about tests of function-like macros.
+
+2022-05-06 Vincent Lefevre <vincent@vinc17.net>
+
+ In comments, changed "stack interface" to "custom interface".
+
+ * src/mpfr.h: changed "stack interface" and "mpfr_stack interface"
+ to "(the) custom interface".
+ * src/stack_interface.c: changed "mpfr_stack" to "custom interface".
+
+ The mpfr_stack_ prefix was changed to mpfr_custom_ in 2005
+ (see commit 0a010e55364d1cc3681273eee70c91dab0a61946) and
+ the MPFR manual says "Custom Interface".
+
+2022-05-06 Vincent Lefevre <vincent@vinc17.net>
+
+ Other corrections about the custom interface.
+
+ This time, the build of tstckintc was failing with "gcc -Wc++-compat"
+ because __cplusplus is not defined.
+
+ * tests/tstckintc.c: use the same solution as already done in
+ tcopysign.c (commit 3dbf3387669030b264317202806fc3d938704618),
+ i.e. ignore -Wc++-compat with "GCC diagnostic" pragmas when
+ testing with void * arguments.
+ Also simplified the code thanks to the VOIDP_CAST macro that
+ was introduced at that time (cast to void * except in C++):
+ commit 9076e47ceb41c60cab526870757f2098ced5c26d.
+
+ Everything should now be OK.
+
+2022-05-06 Vincent Lefevre <vincent@vinc17.net>
+
+ Other corrections about the custom interface.
+
+ In C++, implicit pointer conversions are forbidden. This made the
+ build of tstckintc fail with g++ and -DMPFR_USE_NO_MACRO in CFLAGS.
+
+ * src/mpfr.h: do not attempt to support implicit pointer conversions
+ with a C++ compiler in the macros, since this is not supported by
+ the functions, i.e. removed 2 useless casts; this is a bit like the
+ code like before commit 9f94e0311ed53d0c64d4fbca249d19cc4888027e.
+ * tests/tstckintc.c: test a "void *" argument instead of mpfr_ptr only
+ in C, not C++ (which cannot work if -DMPFR_USE_NO_MACRO is used).
+ Note: for newx and newx2, revert to the code that was before the
+ commit mentioned above.
+
2022-05-06 Vincent Lefevre <vincent@vinc17.net>
Testsuite: C++11 compatibility (GCC's -Wliteral-suffix).
@@ -570,34 +1351,186 @@
2022-05-06 Vincent Lefevre <vincent@vinc17.net>
+ Fixed build failure of user code using mpfr_custom_get_kind() / g++.
+
+ * src/mpfr.h: added missing cast in the mpfr_custom_get_kind() macro
+ (invalid C++ code, but this is in a GNU __extension__ block, thus
+ unfortunately, it was not detected by "gcc -Werror=c++-compat";
+ see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105499>).
+
+ Bug introduced in commit 9f94e0311ed53d0c64d4fbca249d19cc4888027e.
+
+2022-05-05 Vincent Lefevre <vincent@vinc17.net>
+
Fixed issues with the macro versions of the custom interface.
- * src/mpfr.h:
- - fixed the mpfr_custom_* macros so that they behave like the
- associated functions (accept other types than those from the
- prototype, simulating implicit type conversion; evaluate each
- argument once);
- - avoid a -Wsign-conversion warning that could occur in user code
- (issue reported by Andreas Enge concerning PariTwine):
- added a cast in the mpfr_custom_get_size() macro so that a
- size_t * size_t product is done instead of mpfr_prec_t * size_t
- (where mpfr_prec_t is signed and size_t is unsigned, triggering
- a warning when GCC's -Wsign-conversion is used);
- - comments: changed "stack interface" and "mpfr_stack interface"
- to "(the) custom interface".
- * src/stack_interface.c: in a comment, changed "mpfr_stack" to
- "custom interface".
- * tests/tstckintc.c: added testcases for the macro/function mismatch
- issues, being careful with rules that are different in C and C++.
+ * src/mpfr.h: fixed issues with the mpfr_custom_* macros:
+ - a "void *" argument instead of mpfr_ptr could make the
+ compilation fail (with the function, the conversion is
+ implicit, thus this should be accepted by the macro);
+ - some arguments could be evaluated 0 times, which is wrong
+ if their evaluation has side effects.
+ * tests/tstckintc.c: added various tests to check these kinds
+ of issues.
+
+2022-05-05 Vincent Lefevre <vincent@vinc17.net>
+
+ Avoid a -Wsign-conversion warning that could occur in user code.
+
+ Issue reported by Andreas Enge concerning PariTwine.
+
+ * src/mpfr.h: added a cast in the mpfr_custom_get_size() macro so that
+ a size_t * size_t product is done instead of mpfr_prec_t * size_t
+ (where mpfr_prec_t is signed and size_t is unsigned, triggering a
+ warning when GCC's -Wsign-conversion is used).
+
+2022-05-05 Vincent Lefevre <vincent@vinc17.net>
+
+ Fixed mpfr_custom_get_size() macro and added non-regression test.
+
+ * src/mpfr.h: added missing cast in mpfr_custom_get_size() macro.
+ * tests/tstckintc.c: added testcases (would fail on LP64 platforms).
+
+2022-04-22 Vincent Lefevre <vincent@vinc17.net>
+
+ [mpfr-impl.h] Rounding mode macros: added assertion; updated comments.
+
+2022-04-22 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated TODO to improve mpfr_pow_si/sj for negative n.
+
+ I thought that there would be some drawbacks with the underflow
+ by computing the power before the division, but this actually
+ seems to be more or less equivalent (mpfr_pow_general is already
+ used for MPFR_RNDN).
+
+ Also, removed the suggestion with rescaling as this may not be
+ possible for large values of n compared to the maximum exponent.
+
+2022-04-17 Vincent Lefevre <vincent@vinc17.net>
+
+ Corrected comment about the ".POSIX" line in all Makefile.am files.
+
+2022-04-08 Vincent Lefevre <vincent@vinc17.net>
+
+ [TODO] Added idea of implementation for to_chars.
2022-04-07 Vincent Lefevre <vincent@vinc17.net>
- doc/mpfr.texi: Updated the month.
+ [manual] For sqrt and rec_sqrt, mention the relation with rootn.
+
+ Updated TODO about rootn (now that mpfr_rootn_si is implemented).
+
+2022-04-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [src/pow_si.c] Added a static assertion and comments about code improvement.
2022-04-06 Vincent Lefevre <vincent@vinc17.net>
[src/log_ui.c] Updated comments to better understand that the code is correct.
+ Note: these are the same as in the 4.1 branch (commit 8f357dd48).
+ So the ULONG2LONG macro was not necessary, but let's keep it for
+ maintainability. This does not change for GCC and Clang. But tcc
+ even generates shorter x86_64 code with this macro.
+
+2022-04-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/tpow.c] Improved/added bad_cases tests of mpfr_pow_ui/si (x^n).
+
+ * For n odd, generate negative values y (thus x) with a probability
+ 1/2 (instead of a very low probability), as there is no reason to
+ favor positive values in this case.
+ * Added bad_cases tests of mpfr_pow_si with n negative (with the help
+ of mpfr_rootn_si). This was the TODO from commit 58fc9fb0e.
+
+2022-04-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests] In some bad_cases messages, output the name of the function.
+
+ This is useful for tests with several bad_cases invocations,
+ such as tpow, troot and trootn_si.
+
+2022-04-06 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests/{troot,trootn_si}.c] Added a comment about bad_cases.
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ Added /trootn_si to tests/.gitignore
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ src/root.c: for mpfr_rootn_si with k = -2, use mpfr_rec_sqrt.
+
+ The mpfr_rec_sqrt code is faster than the generic mpfr_rootn_si code
+ for k = -2.
+
+ Also added a TODO: if MPFR_WANT_ASSERT >= 2, do both computations
+ and compare the results.
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ tests/trootn_si.c: fixed typo in error messages.
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ src/pow_ui.c: bug fix with mini-gmp and limb < unsigned long.
+
+ The initial precision was too small for large values of n.
+ → tpow and trootn_si no longer fail.
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ tests/tpow.c: better generic tests for mpfr_pow_ui and mpfr_pow_si.
+
+ Changed INT_RAND_FUNCTION, in particular to use randulong / randlong
+ for mini-gmp, yielding an assertion failure when MINI_GMP_LIMB_TYPE
+ is shorter than "long".
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ mpfrlint: ignore mini-gmp in some test.
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ mpfr_rootn_si(): bug fix for n = LONG_MIN; added generic tests.
+
+ * src/root.c: bug fix in mpfr_rootn_si() for n = LONG_MIN
+ (integer overflow on -n, triggered by the generic tests).
+ * tests/trootn_si.c: added generic tests.
+ Note: they currently yield an assertion failure in pow_ui.c with
+ mini-gmp when MINI_GMP_LIMB_TYPE is shorter than "long".
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests] Add randulong and randlong functions (useful with mini-gmp).
+
+ To get a random unsigned long, randlimb() is currently used, but with
+ mini-gmp, a limb may be shorter than an unsigned long, so that one
+ does not get all the possible "unsigned long" values. So these new
+ randulong() and randlong() functions should now be used instead.
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ Define a ULONG2LONG() macro to convert from unsigned long to long.
+
+ The conversion is done with the two's complement rule
+ (i.e. modular arithmetic) in a portable way.
+ * doc/README.dev: mention this macro (the technique was already
+ described).
+ * src/log_ui.c: use this macro instead of non-portable code due to
+ the case n = LONG_MAX + 1.
+ * src/mpfr-impl.h: define this macro.
+
+2022-04-05 Vincent Lefevre <vincent@vinc17.net>
+
+ trootn_si.c: more mpfr_rootn_si tests on special values
+
+ doc/mpfr.texi: Updated the month.
+
+ New function mpfr_rootn_si
+
2022-04-04 Vincent Lefevre <vincent@vinc17.net>
[src/root.c] Updated a comment for mpfr_rootn_ui.
@@ -608,8 +1541,24 @@
2022-04-04 Vincent Lefevre <vincent@vinc17.net>
+ [tests/troot.c] Added a comment.
+
+ [tests/tpow.c] Added a TODO about tests with bad_cases.
+
[tests/tpow.c] Corrected messages.
+ [tests/tpow.c] For rootN, use mpfr_root and mpfr_rootn_ui randomly.
+
+2022-04-04 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests] Define RAND_BOOL() macro (random boolean) and use it.
+
+ In the tests directory:
+ * mpfr-test.h: define RAND_BOOL() macro, with type int.
+ * mpfr-test.h and various .c files: replace "randlimb () & 1" and
+ "randlimb () % 2" by "RAND_BOOL ()".
+ * tfprintf.c, tsprintf.c: use the same code as tprintf.c.
+
2022-04-04 Vincent Lefevre <vincent@vinc17.net>
In the tests, fixed "randlimb () % 1", mistaken for "randlimb () & 1".
@@ -617,7 +1566,7 @@
This occurred only in tests/tfmma.c (5 occurrences), with the
consequence of fewer cases of different kinds in the tests.
- Such a kind of mistake is now detected by mpfrlint (commit 02a17d21a).
+ Such a kind of mistake is now detected by mpfrlint (commit 2a90f0c91).
2022-04-04 Vincent Lefevre <vincent@vinc17.net>
@@ -626,16 +1575,29 @@
This is probably mistaken for "& 1" or "% 2", as currently in
"tests/tfmma.c".
- (same as commit 2a90f0c91b35b23bd85a8a9ceb23426e3b36b91b)
+2022-03-30 Vincent Lefevre <vincent@vinc17.net>
+
+ [TODO] Moved and updated item.
+
+ Since this is about functions in IEEE 754-2019, it makes more sense
+ to have this item after the new functions of IEEE 754-2008.
2022-03-30 Vincent Lefevre <vincent@vinc17.net>
+ [TODO] Updated item (with non-public URL removed).
+
+2022-03-29 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [TODO] added item
+
+2022-03-29 Vincent Lefevre <vincent@vinc17.net>
+
Fixed version-ext.sh, in particular when used after "./autogen.sh".
After running autogen.sh, version-ext.sh incorrectly detected files
as modified. Solution: refresh the git index before git diff-index.
-2022-03-30 Vincent Lefevre <vincent@vinc17.net>
+2022-03-28 Vincent Lefevre <vincent@vinc17.net>
[acinclude.m4] Fix/improve MPFR_CHECK_LIBM and MPFR_CHECK_LIBQUADMATH.
@@ -646,6 +1608,80 @@
Also updated MPFR_CHECK_LIBM from the current libtool.m4 code, as
done in the past.
+2022-03-24 Vincent Lefevre <vincent@vinc17.net>
+
+ [get_d128.c] Updated FIXME comment.
+
+2022-03-24 Vincent Lefevre <vincent@vinc17.net>
+
+ Added a TODO efficiency item about the size of the MPFR library.
+
+ Reduce the size of the MPFR library generated by GCC by avoiding
+ operations on _Decimal128 in get_d128.c when its encoding is BID.
+
+2022-02-18 Vincent Lefevre <vincent@vinc17.net>
+
+ [algorithms.tex] Cleanup: ^\infty → ^{\infty}
+
+ Using a command after _ (subscript) or ^ (superscript) is discouraged
+ as it might break with future TeX versions, as already seen.
+ Discussion:
+ https://tug.org/pipermail/tex-live/2022-February/047780.html
+
+2022-02-18 Vincent Lefevre <vincent@vinc17.net>
+
+ [algorithms.tex] Updated 2 URLs in comments (http → https).
+
+2022-02-03 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated a comment: added a ref to WG14/N2921 about large bit-fields.
+
+2022-01-18 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/nrandom.c] added reference
+
+2022-01-18 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated the FIXME in acinclude.m4 for MPFR_CHECK_LIBM.
+
+2022-01-18 Vincent Lefevre <vincent@vinc17.net>
+
+ Added FIXME in acinclude.m4 for MPFR_CHECK_LIBM.
+
+ With a GCC snapshot:
+ error: infinite recursion detected [-Werror=infinite-recursion]
+
+2022-01-14 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [TODO] removed an item (done in the web page for each release)
+
+2022-01-14 Vincent Lefevre <vincent@vinc17.net>
+
+ doc/mpfr.texi: Updated the month.
+
+2022-01-12 Vincent Lefevre <vincent@vinc17.net>
+
+ [tests] Added a comment about the output of pointer values.
+
+2022-01-10 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/README.dev] Updated "To make a release".
+
+ Added a paragraph about config.guess and config.sub.
+
+2022-01-06 Vincent Lefevre <vincent@vinc17.net>
+
+ Added a TODO to improve mpfr_pow_si/sj.
+
+ Computing POW_U before the division (instead of after) would reduce
+ the error in the intermediate result.
+
+2022-01-06 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated a comment about a clang bug.
+
+ Updated a comment about a clang bug.
+
2022-01-06 Vincent Lefevre <vincent@vinc17.net>
Copyright notice update: added 2022.
@@ -658,9 +1694,11 @@
2021-12-26 Vincent Lefevre <vincent@vinc17.net>
+ README.dev: added C2x draft URL (N2731).
+
Corrected style (spurious space before comma).
-2021-12-26 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+2021-12-21 Paul Zimmermann <Paul.Zimmermann@inria.fr>
gnu style
@@ -690,27 +1728,122 @@
be done on the full branch name, not a subword; so, added the -x grep
option (specified by POSIX).
+2021-11-25 Vincent Lefevre <vincent@vinc17.net>
+
+ Updated tests_run_within_valgrind() comment in "tests/tests.c".
+
+2021-11-23 Vincent Lefevre <vincent@vinc17.net>
+
+ README.dev: added note about the formally proven code and requirements.
+
+ Update of INSTALL file about CompCert.
+
+2021-11-22 Vincent Lefevre <vincent@vinc17.net>
+
+ doc/mpfr.texi: Updated the month.
+
+2021-11-22 Vincent Lefevre <vincent@vinc17.net>
+
+ For git info output by "make check", check for modifications.
+
+ tests/Makefile.am: updated output_info code to add " (modified)"
+ when the working tree has been modified (compared to HEAD).
+
+2021-11-22 Vincent Lefevre <vincent@vinc17.net>
+
+ Added info to doc/README.dev about <branch>-root tags.
+
+2021-11-22 Vincent Lefevre <vincent@vinc17.net>
+
+ Removed a usless comment about git info output by "make check".
+
+ tests/Makefile.am: removed the comment about the unimplemented
+ solution with possible *-branch tags (I think that it would not
+ work well with merges).
+
+2021-11-22 Vincent Lefevre <vincent@vinc17.net>
+
+ Improved code to output git info from "make check".
+
+ tests/Makefile.am: updated output_info code and comment.
+ We now use <branch>-root tags to find to correct branch, by excluding
+ branches created after the current HEAD.
+
2021-11-22 Vincent Lefevre <vincent@vinc17.net>
- Add git info for "make check".
+ Fixed git info output by "make check".
+
+ tests/Makefile.am: in output_info, added a "|| true" on a shell command
+ that may fail (grep with no matches).
+
+2021-11-22 Vincent Lefevre <vincent@vinc17.net>
+
+ Added a FIXME for git info output by "make check".
+
+ The recent additions to tests/Makefile.am work well for master (and
+ detached HEAD state), but not for the 4.1 branch, where $gitb gets
+ empty, even though testing from an interactive shell (/bin/sh = dash)
+ does not show any issue.
- tests/Makefile.am: in output_info, add git info:
+2021-11-22 Vincent Lefevre <vincent@vinc17.net>
+
+ Improved git info output by "make check".
+
+ tests/Makefile.am: modified output_info to output:
* the detected branch, which also works in detached HEAD state
- (<branch>-root tags are used to find the correct branch,
- by excluding branches created after the current HEAD);
+ (for old commits that can be found in multiple branches,
+ "master" is prefered over the other branches);
* the total commit count;
- * the commit id (hash);
- * " (modified)" when the working tree has been modified
- (compared to HEAD).
+ * the commit id (hash).
-2021-10-24 Vincent Lefevre <vincent@vinc17.net>
+2021-11-22 Vincent Lefevre <vincent@vinc17.net>
- Updated README due to the migration to Inria GitLab.
+ Add git info with "git describe" for "make check" (to be improved).
+
+ tests/Makefile.am: in output_info, add git info, but this does not
+ output the branch. For instance, on master, one gets something like
+ "4.1-root-491-g2933fad3a", and something similar on the 4.1 branch.
+ As the solution needs to work in detached HEAD state, we may want to
+ add *-branch tags to identify the first commit of a branch, and use
+ git describe --match '*-branch'
+ instead of
+ git describe --match '*-root'
+
+2021-11-15 Vincent Lefevre <vincent@vinc17.net>
+
+ Documentation: some improvements about the "decimal-point character".
+
+ * doc/README.dev: update about the use in the MPFR manual (mpfr.texi).
+ * doc/mpfr.texi: minor correction.
+
+2021-11-05 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/algorithms.tex] Add \pdfglyphtounicode{lscript}{2113} for \ell.
+
+ Otherwise one gets a grave accent (thus "s − l" cannot be found).
+ If the "â„“" is still an issue, one could alternatively use
+ \pdfglyphtounicode{lscript}{006C}
+ to get an "l" (but "l" also matches "â„“" in xpdf and atril).
+
+2021-11-05 Vincent Lefevre <vincent@vinc17.net>
+
+ [doc/algorithms.tex] Add some ToUnicode mappings.
+
+ This fixes some regressions compared to old LaTeX versions (in 2009).
+
+2021-10-24 Vincent Lefevre <vincent@vinc17.net>
doc/mpfr.texi: Updated the month.
2021-10-24 Vincent Lefevre <vincent@vinc17.net>
+ mpfrlint: fixed git usage.
+
+ The change done in 52138701d9b920d608871b20d4bee30f59adede6 wasn't
+ working when the latest commit wasn't on "doc/mpfr.texi".
+
+2021-10-24 Vincent Lefevre <vincent@vinc17.net>
+
mpfrlint: update for git.
This is used to check that the doc/mpfr.texi UPDATED-MONTH value is
@@ -732,6 +1865,36 @@
It is no longer needed, as least since Texinfo 4.2:
https://ftp.gnu.org/old-gnu/Manuals/texinfo-4.2/html_node/Refilling-Paragraphs.html
+2021-10-19 Vincent Lefevre <vincent@vinc17.net>
+
+ Added .mailmap file.
+
+2021-10-17 Vincent Lefevre <vincent@vinc17.net>
+
+ Added a TODO/FIXME to add Git information to "make check".
+
+ Partial update of doc/README.dev due to the migration to Inria GitLab.
+
+ Updated README due to the migration to Inria GitLab.
+
+2021-09-27 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mparam_h.in] Updated comment about GCC.
+
+2021-09-24 Vincent Lefèvre <vincent@vinc17.net>
+
+ [INSTALL] Update about MinGW: the old mingw.org website no longer
+ exists, and MinGW has actually been replaced by Mingw-w64, which
+ is for both 32-bit and 64-bit Windows.
+
+ [README] Updated URLs.
+
+2021-09-20 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ missing url
+
+ added new preprint
+
2021-09-16 Vincent Lefèvre <vincent@vinc17.net>
[doc/mpfr.texi] Updated the month.
@@ -746,108 +1909,286 @@
The cause is a sentence that was inserted at the wrong place in r8225
(2012-06-25).
- (merged changeset r14580 from the trunk)
+2021-09-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/inp_str.c] Added a FIXME on a deprecated use of ungetc.
2021-09-13 Vincent Lefèvre <vincent@vinc17.net>
- [configure.ac] Reverted r14572, which was solving an issue about the
- ordering of macros with ax_pthread.m4 29.
+ Autoconf / AX_PTHREAD related update and cleanup.
- But the change done in ax_pthread.m4 29
- https://github.com/autoconf-archive/autoconf-archive/commit/2567e0ce0f3a11b535c6b527386197fb49ff172b
- was incorrect (see comments at this URL) and was reverted in
- ax_pthread.m4 31:
- https://github.com/autoconf-archive/autoconf-archive/commit/59008cc7f85e1982eb298e1c424c2e6ad5942c4a
- (Debian/unstable had the buggy version during a couple of weeks).
+ * m4/ax_pthread.m4: update to AX_PTHREAD 31, fixing a change
+ from AX_PTHREAD 29, which has eventually been regarded as
+ a bug (workaround in r14481).
+ * configure.ac: removed the now unneeded AC_CANONICAL_TARGET;
+ updated the corresponding comment.
+
+2021-09-09 Vincent Lefèvre <vincent@vinc17.net>
+
+ [TODO] More about intrinsics (e.g. _addcarry_u64).
+
+ [TODO] + use intrinsics when available (needs a configure test).
2021-09-07 Vincent Lefèvre <vincent@vinc17.net>
+ [tests/tests.c] In a comment with a GMP_CHECK_RANDOMIZE value, mention
+ the SVN revision and date, as this value may no longer be valid in the
+ future (when tests are added or changed).
+
[tests/tests.c] Fixed bad_cases when y is ±0 (rare case).
- (merged changeset r14570 from the trunk, with GMP_CHECK_RANDOMIZE value
- in a comment changed for the current revision in the 4.1 branch)
+2021-08-23 Vincent Lefèvre <vincent@vinc17.net>
-2021-09-07 Vincent Lefèvre <vincent@vinc17.net>
+ [doc/README.dev] Updated/reduced note about MinGW and stdio.
- [configure.ac] Avoid an issue with ordering of macros we don't use
- explicitly, which appears with ax_pthread.m4 29, i.e. with
- https://github.com/autoconf-archive/autoconf-archive/commit/2567e0ce0f3a11b535c6b527386197fb49ff172b
+2021-08-23 Vincent Lefèvre <vincent@vinc17.net>
- (merged changeset r14481 from the trunk)
+ [INSTALL] Updated information about MinGW and the formatted output
+ functions (printf, etc.).
-2021-09-07 Vincent Lefèvre <vincent@vinc17.net>
+ Thanks to Pali Rohár for the information about -std=c89.
- Get rid of obsolescent AC_HEADER_TIME. Cleanup about sys/time.h usage.
+2021-08-23 Vincent Lefèvre <vincent@vinc17.net>
- The AC_HEADER_TIME macro is obsolescent in autoconf 2.69 (2012),
- and autoconf 2.71 (2021) outputs a warning, which makes autogen.sh
- fail due to "--warnings=all,error", so let's avoid the warnings.
- This macro defines TIME_WITH_SYS_TIME, used only in tests/tests.c
- (but actually not needed). We actually have two cases:
- 1. HAVE_GETTIMEOFDAY is defined: we use gettimeofday(), which
- needs <sys/time.h>.
- 2. Otherwise: we use time(), which needs <time.h>.
+ [tests/tget_set_d128.c] Removed a useless C99 comment, which makes
+ the MPFR build fail with "i686-w64-mingw32-gcc -std=c89" (e.g. via
+ ./configure --host=i686-w64-mingw32, and -std=c89 in CFLAGS).
- Based on that, we can simplify the condition in tests/tests.c for
- the inclusion of time-related headers, and we no longer need to
- check the <sys/time.h> availability. If gettimeofday() is defined
- but <sys/time.h> is not available (which shouldn't occur), then
- the current gettimeofday() usage may be incorrect anyway.
+ [tests/tsprintf.c] In locale_da_DK(), also try da_DK.utf8 (preferably):
+ in Debian/unstable, da_DK no longer exists.
- Changes:
- * acinclude.m4:
- - no longer use AC_HEADER_TIME;
- - no longer check the sys/time.h header.
- * tests/tests.c: simplify the inclusion of time-related headers.
+2021-08-20 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+ [doc/mpfr.texi] Corrected latest change (typography).
+
+ [doc/mpfr.texi] Detail the mpfr_min and mpfr_max description.
+
+2021-08-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tget_flt.c] Avoid a warning about unused function equal_flt
+ when HAVE_SUBNORM_FLT is not defined.
+
+ [tests/tget_flt.c] Code style: replaced "… == 0" by "! …" on
+ the Boolean _p functions.
+
+2021-08-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tget_flt.c] Removed bug_icx (duplicate test).
+
+ What was tested was just mpfr_get_flt on a NaN mpfr_t. But this was
+ already tested in main(). And one gets the same result and error with
+ icx (without -fp-model=strict). Moreover, the old test was correctly
+ protected by "#if !defined(MPFR_ERRDIVZERO)", needed because NaN is
+ defined by 0.0 / 0.0.
+
+2021-08-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tget_flt.c] In bug_icx: replaced mpfr_set_flt, whose float
+ argument was yielding an underflow (not portable), by mpfr_set_si_2exp
+ (it is mpfr_get_flt that is tested, not mpfr_set_flt).
+
+ [tests/tget_flt.c] Added FIXME for test added in r14552.
+
+ [tests/tget_flt.c] Portability correction.
- (merged changeset r14479 from the trunk)
+2021-08-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
-2021-06-01 Vincent Lefèvre <vincent@vinc17.net>
+ need -fp-model=strict for icx
+
+2021-07-27 Vincent Lefèvre <vincent@vinc17.net>
+
+ [TODO] Mention "[[noreturn]]".
+
+2021-07-15 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/ieee_floats.h] URL update (http → https).
+
+2021-07-01 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tools/mpfrlint] Detect when the return value of fclose() or fflush()
+ is compared with -1 instead of EOF.
+
+2021-06-30 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tprintf.c] Portability correction (EOF is not necessarily -1).
+
+2021-06-21 Vincent Lefèvre <vincent@vinc17.net>
+
+ Punctuation (missing comma after "however").
+
+ [doc/README.dev] No longer use /tmp in examples so that the reader is
+ not encouraged to use it. Punctuation.
+
+2021-06-08 Vincent Lefèvre <vincent@vinc17.net>
+
+ [acinclude.m4] Fixed subnormal detection (issue found with icx).
+
+2021-06-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tget_d.c] Improved error messages.
+
+2021-06-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tget_d.c] Error message when check_inf_nan() fails for NaN.
+
+ Note: With "icx -O2" (at least), 8 tests are now failing with
+ Intel(R) oneAPI DPC++ Compiler 2021.2.0 (2021.2.0.20210317).
+ But no failures when the compiler is invoked as "clang".
+
+2021-06-02 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+2021-06-02 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [doc/mpfr.texi] some figures about slowdown with C++ interface
+
+2021-06-01 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/data/j1] added more tests
[tests/tests.c] fixed bug introduced in r13787, which invalidated data_check
in some cases
- (merged changeset r14531 from the trunk)
-
-2021-05-17 Vincent Lefèvre <vincent@vinc17.net>
+2021-05-20 Vincent Lefèvre <vincent@vinc17.net>
- [tests/tsprintf.c] Commented out a test added in r14524.
+ [doc/mpfr.texi] Completed mpfr_fmodquo and mpfr_remquo description.
- This test of length specifier 'P' with an empty precision field (only a
- period) fails in the 4.1 branch due to an issue fixed only in the trunk
- (r14155). In the 4.1 branch, the MPFR manual contains contradictory
- information about this, which can be regarded as unspecified behavior.
+ [src/rem1.c] Improved comments.
2021-05-17 Vincent Lefèvre <vincent@vinc17.net>
- Formatted output functions (mpfr_*printf): bug fix; added tests.
-
- * src/vasprintf.c: in buffer_cat, replaced incorrect assertion len > 0
- by a test.
- Note that len == 0 is possible when outputting an integer 0
- (either a native one or mpfr_prec_t) with precision field = 0.
- The consequence of this bug:
- - In debug mode (MPFR_ASSERTD assertion checking), one would get
- an assertion failure.
- - Otherwise, there should be no side effects since the code was
- valid for len == 0, possibly except with LTO (very unlikely,
- though).
- This incorrect assertion was added on 2009-03-13 in r6099.
- * tests/tsprintf.c: added tests of native integer 0 and mpfr_prec_t
- (specifier 'P') with precision field 0, both yielding a call to
- buffer_cat with len = 0.
-
- (merged changesets r14514,14520-14521 from the trunk)
+ [tests/tsprintf.c] Cosmetic revert of blank line removal in r14519.
2021-05-17 Vincent Lefèvre <vincent@vinc17.net>
- [doc/mpfr.texi] Updated the month.
+ [src/vasprintf.c] Fixed buffer_cat: replaced incorrect assertion len > 0
+ by a test.
+
+ Note that len == 0 is possible when outputting an integer 0 (either a
+ native one or mpfr_prec_t) with precision field = 0. The consequence
+ of this bug:
+ * In debug mode (MPFR_ASSERTD assertion checking), one would get an
+ assertion failure.
+ * Otherwise, there should be no side effects since the code was valid
+ for len == 0, possibly except with LTO (very unlikely, though).
+
+ This incorrect assertion was added on 2009-03-13 in r6099.
2021-05-17 Vincent Lefèvre <vincent@vinc17.net>
+ [tests/tsprintf.c] Similarly to r14514, added tests of native integer 0
+ with precision field 0 (also yields a call to buffer_cat with len = 0).
+
+ [tests/tsprintf.c] For various test functions, changed the return type
+ from int to void (when the value is never used).
+
+2021-05-16 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/vasprintf.c] Updated comment about the output for the 'a'/'A'
+ conversion specifier.
+
+ [doc/mpfr.texi] Formatted output functions (mpfr_*printf): completed
+ the specification concerning the precision (this was needed because
+ the conversion specifier 'b' does not exist in C).
+
+2021-05-12 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/vasprintf.c] Added a comment about the output for the 'a'/'A'
+ conversion specifier, which is completely unintuitive. FIXME?
+
[doc/mpfr.texi] Punctuation.
- (merged changeset r14515 from the trunk)
+ [tests/tsprintf.c] Added tests of specifier 'P' with precision field 0.
+
+2021-05-11 Vincent Lefèvre <vincent@vinc17.net>
+
+ [TODO] More about mpfr_fda / mpfr_fds.
+
+ [TODO] + Fused divide-add and fused divide-subtract (mpfr_fda, mpfr_fds).
+
+2021-05-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi,src/mpfr.h] Detail about the mpfr_pown implementation.
+
+2021-05-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [NEWS] added missing mpfr_pown (alias for mpfr_pow_sj)
+
+ [manual] added mpfr_powm in NEWS
+ (https://sympa.inria.fr/sympa/arc/mpfr/2021-05/msg00000.html)
+
+2021-05-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month (due to r14505).
+
+2021-04-30 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/sin.c] Added a TODO about range reduction.
+
+2021-04-26 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tstrtofr.c] Check more infinity strings.
+
+2021-04-26 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc] Update about "case insensitive" and issue with Turkish locales
+ for "I" / "i".
+
+ * mpfr.texi: added "with the rules of the C locale" in the
+ mpfr_strtofr description.
+ * README.dev: completed information about Turkish locales.
+
+2021-04-24 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tpowr.c] Added generic tests.
+
+ [src/exceptions.c] Corrected latest comment.
+
+2021-04-23 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/exceptions.c] Replaced comment about logging (the issue was due to
+ the mpfr_check_range macro).
+
+ [src/exceptions.c] Completed comment about a logging issue.
+
+ [src/exceptions.c] Added a comment about a logging issue.
+
+ [src/mpfr-impl.h] Logging: output the flags at "IN" and "OUT".
+
+ [tests/tsgn.c] Also test in a very reduced exponent range.
+
+ [tests/tsgn.c] Also test the flags.
+
+2021-04-23 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/get_str.c] Fixed bug in mpfr_get_str_ndigits introduced in r14494.
+
+ Note: the issue (an uninitialized variable) was detected by GCC 6.5.0;
+ recent GCC versions miss the -Wmaybe-uninitialized warning.
+
+2021-04-23 Vincent Lefèvre <vincent@vinc17.net>
+
+ mpfr_get_str_ndigits: added an assertion / exploitable compiler hint.
+
+ [src/get_str.c] Improved mpfr_get_str_ndigits code structure.
+
+2021-04-23 Vincent Lefèvre <vincent@vinc17.net>
+
+ In various functions, use mpfr_equal_p() instead of mpfr_cmp() == 0.
+
+ Note: In these cases, the test should be false if one of the arguments
+ is NaN (it is not always clear whether NaN is impossible, but just in
+ case, mpfr_equal_p is safer, in particular if the code around changes;
+ and this is more readable too).
+
+2021-04-23 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/get_str.c] Use mpfr_equal_p() instead of mpfr_cmp() == 0.
+
+ [tests] Added tpowr to svn:ignore property.
2021-04-23 Vincent Lefèvre <vincent@vinc17.net>
@@ -861,13 +2202,91 @@
[*] https://sympa.inria.fr/sympa/arc/mpfr/2021-04/msg00000.html
- (merged changeset r14488 from the trunk)
+2021-04-16 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr-impl.h] Added cast to int for __LINE__ in formatted output.
+
+ The standard just says that __LINE__ in an integer constant. So its
+ type might be larger than int, even though the value is representable
+ in an int (like in MPFR). This concerns logging code, only available
+ for GCC compatible compilers, so that there should not be any issue
+ without the cast, but just in case...
+
+2021-04-02 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/thypot.c] added one test
+
+2021-03-19 Vincent Lefèvre <vincent@vinc17.net>
+
+ Added m4/ax_pthread.m4 file, and related updates.
+
+ Added m4/ax_pthread.m4 from
+ https://github.com/autoconf-archive/autoconf-archive
+ and updated:
+ * acinclude.m4 (in particular, set CXX and CXXFLAGS)
+ * doc/README.dev
+
+2021-03-19 Vincent Lefèvre <vincent@vinc17.net>
+
+ [configure.ac] Avoid an issue with ordering of macros we don't use
+ explicitly, which appears with ax_pthread.m4 29, i.e. with
+ https://github.com/autoconf-archive/autoconf-archive/commit/2567e0ce0f3a11b535c6b527386197fb49ff172b
+
+2021-03-18 Vincent Lefèvre <vincent@vinc17.net>
+
+ [acinclude.m4] Added a comment about AX_PTHREAD.
+
+2021-03-18 Vincent Lefèvre <vincent@vinc17.net>
+
+ Get rid of obsolescent AC_HEADER_TIME. Cleanup about sys/time.h usage.
+
+ The AC_HEADER_TIME macro is obsolescent in autoconf 2.69 (2012),
+ and autoconf 2.71 (2021) outputs a warning, which makes autogen.sh
+ fail due to "--warnings=all,error", so let's avoid the warnings.
+ This macro defines TIME_WITH_SYS_TIME, used only in tests/tests.c
+ (but actually not needed). We actually have two cases:
+ 1. HAVE_GETTIMEOFDAY is defined: we use gettimeofday(), which
+ needs <sys/time.h>.
+ 2. Otherwise: we use time(), which needs <time.h>.
+
+ Based on that, we can simplify the condition in tests/tests.c for
+ the inclusion of time-related headers, and we no longer need to
+ check the <sys/time.h> availability. If gettimeofday() is defined
+ but <sys/time.h> is not available (which shouldn't occur), then
+ the current gettimeofday() usage may be incorrect anyway.
+
+ Changes:
+ * acinclude.m4:
+ - no longer use AC_HEADER_TIME;
+ - no longer check the sys/time.h header.
+ * tests/tests.c: simplify the inclusion of time-related headers.
+
+2021-03-18 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tools/mpfrlint] Detect mpn_mul_n with identical 2nd and 3rd arguments,
+ which can be replaced by the faster mpn_sqr.
+
+2021-03-16 Vincent Lefèvre <vincent@vinc17.net>
+
+ Replaced "intensional" by "intentional" in comments.
+
+ Untabify and remove trailing spaces.
+
+2021-03-16 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/rec_sqrt.c] replace a call to mpn_mul_n with identical arguments by
+ a call to mpn_sqr + similar changes in other files
+ (thanks Fredrik Johansson)
+
+ [tests/trec_sqrt.c] added timing test
2021-03-09 Vincent Lefèvre <vincent@vinc17.net>
[doc/mpfr.texi] Updated the month.
-2021-03-09 Vincent Lefèvre <vincent@vinc17.net>
+ [src/mpfr.h] Comment: no need to write "user" with uppercase letters.
+
+2021-03-08 Vincent Lefèvre <vincent@vinc17.net>
[tests/{tset_si.c,tset_sj.c}] Fix when -DMPFR_USE_NO_MACRO is used.
@@ -882,91 +2301,823 @@
mpfr_get_exp has been replaced by MPFR_GET_EXP, so that the argument
is checked with --enable-assert.
- (merged changeset r14464 from the trunk)
+2021-03-08 Vincent Lefèvre <vincent@vinc17.net>
-2021-03-09 Vincent Lefèvre <vincent@vinc17.net>
+ [tests/{texceptions.c,tset_exp.c}] Forgot to protect the tests with
+ casts to "void *", invalid in C++ (completing r14460 and r14461).
- In mpfr.h, fixed some macros implementing functions. Added tests.
-
- * src/mpfr.h:
- - Macros mpfr_nan_p, mpfr_inf_p, mpfr_zero_p, mpfr_regular_p,
- mpfr_get_prec, mpfr_get_exp, mpfr_copysign and mpfr_signbit
- yielded a compilation error when the argument (the 3rd one
- for mpfr_copysign) was of type void *, for instance.
- - Macro mpfr_set had the same issue with the 2nd argument, but
- also evaluated this argument twice. The fix was possible only
- with a GNU extension. Thus this macro is available only with
- GCC and compatible compilers (see __GNUC__); otherwise, the
- mpfr_set function is used.
- * src/ubf.c: added a missing cast (this issue became visible with
- the fix of the mpfr_get_prec macro).
- * tests/mpfr-test.h: added macros for the new tests (tests with
- void * arguments are invalid in C++ and they trigger a warning
- with GCC's -Wc++-compat, so we need to avoid these issues).
- * tests/*.c: added tests to check that some calls (potentially
- macros) behave like function calls. In detail:
- - tcopysign.c: mpfr_copysign and mpfr_setsign.
- - texceptions.c: mpfr_get_prec.
- - tisnan.c: mpfr_nan_p, mpfr_inf_p, mpfr_number_p (though not
- currently concerned here), mpfr_zero_p and mpfr_regular_p.
- - tset.c: mpfr_set.
- - tset_exp.c: mpfr_get_exp.
- * doc/mpfr.texi: added some text in Section "Custom Interface" to
- clarify the usage of macros for this interface.
-
- (merged changesets r14447-14463 from the trunk)
+2021-03-08 Vincent Lefèvre <vincent@vinc17.net>
-2021-03-09 Vincent Lefèvre <vincent@vinc17.net>
+ Clarification about the custom interface and macros.
- Completed tests/tcopysign.c to test with a reused argument.
+ * doc/mpfr.texi: added some text in Section "Custom Interface".
+ * src/mpfr.h: replaced the remaining FIXME by another comment.
+
+2021-03-08 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests] Ignore GCC's -Wc++-compat in the tests that are invalid in C++
+ (these tests are enabled only if __cplusplus is not defined).
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests] In C++, do not cast to "void *" in the tests of macros.
+
+ These casts make the build of these tests fail with a C++ compiler.
+ But this means that the use of macros will not introduce any issue
+ concerning the type of the arguments, i.e. with a C++ compiler, the
+ tests are still complete after this change.
+
+ However, GCC's -Werror=c++-compat still cannot be used.
+ To avoid this issue, diagnostic pragmas will be needed.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr.h] Fixed mpfr_set macro (now only available with __GNUC__).
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tset.c] Added tests of the mpfr_set macro.
+
+ Without MPFR_USE_NO_MACRO, the compilation currently fails because
+ the second argument is not converted to mpfr_srcptr when MPFR_SIGN
+ is applied.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr.h] Fixed mpfr_copysign and mpfr_signbit macros.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ Added tests of mpfr_copysign, mpfr_setsign and mpfr_signbit macros.
+
+ Without MPFR_USE_NO_MACRO, the compilation of these tests in tcopysign.c
+ currently fails because some arguments are not converted to mpfr_srcptr.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
- (merged part of changeset r14227 from the trunk)
+ [src/ubf.c] Forgot a cast from UBF pointer to mpfr_t pointer.
+
+ This became visible with the fix of the mpfr_get_prec macro in r14454.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr.h] Fixed mpfr_get_prec and mpfr_get_exp macros.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ Added tests of mpfr_get_prec and mpfr_get_exp macros.
+
+ Without MPFR_USE_NO_MACRO, the compilation of these tests
+ in texceptions.c and tset_exp.c currently fails because
+ the argument is not converted to mpfr_srcptr.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr.h] Better implementation of macros changed in r14451.
+ __GNUC__ is no longer needed.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr.h] Fixed some macros implementing functions.
+
+ Macros mpfr_nan_p, mpfr_inf_p, mpfr_zero_p and mpfr_regular_p were
+ incorrect since they yielded a compilation error when the argument
+ was of type void *, for instance. Their definition as macros is now
+ available only with __GNUC__.
+ The tisnan test r14448 should no longer fail.
+
+ Also added a comment for mpfr_sgn, which is correct since documented
+ as a macro.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tisnan.c] Added commented code for testing compilation errors.
+
+2021-03-06 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/mpfr.h] fixed typo
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tisnan.c] Check that when mpfr_nan_p, mpfr_inf_p, mpfr_number_p,
+ mpfr_zero_p and mpfr_regular_p is implemented as a macro, it behaves
+ like a function.
+
+ [src/mpfr.h] Added a comment and a FIXME for functions implemented
+ as macros.
+
+2021-03-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ Reverted r14445: This is about functions implemented as macros, and
+ in this case, a macro must behave like a function.
+
+ In particular, each argument must be evaluated one time exactly.
+ Macros that behave differently will need to be fixed.
+
+ Tests should also be added like the one in tests/tset_si.c with the
+ comment:
+
+ /* Note: the ++'s below allow one to check that the corresponding
+ arguments are evaluated only once by the macros. */
+
+2021-03-06 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [doc/mpfr.texi] document that functions defined as macros might evaluate
+ their arguments several times
+ (see https://sympa.inria.fr/sympa/arc/mpfr/2021-03/msg00007.html)
+
+ [src/mpfr.h] fixed typo
+
+2021-03-04 Vincent Lefèvre <vincent@vinc17.net>
+
+ [TODO] Clarification.
+
+ [TODO] Updated item on pkg-config due to a bug in pkg-config.
+
+ [TODO] Added "add some option to use pkg-config...".
+
+2021-02-16 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/invsqrt_limb.h] use "unsigned short" for table T[] instead of mp_limb_t.
+ On araignee.loria.fr, this saves about 1 cycle, when GMP 6.2.1 and MPFR are
+ configured with --disable-shared, using mbench.
+
+ Before this change (medium of 5 runs, with turbo-boost disabled):
+ $ numactl --physcpubind=0 ./mfv5 -i0 -p53 mpfr_sqrt mpfr_sqrt mpfr_sqrt
+ mpfr_sqrt: 48 / 53.39 / 60
+ $ numactl --physcpubind=0 ./mfv5 -i0 -p113 mpfr_sqrt mpfr_sqrt mpfr_sqrt
+ mpfr_sqrt: 75 / 81.44 / 89
+
+ After this change:
+ $ numactl --physcpubind=0 ./mfv5 -i0 -p53 mpfr_sqrt mpfr_sqrt mpfr_sqrt
+ mpfr_sqrt: 48 / 52.37 / 60
+ $ numactl --physcpubind=0 ./mfv5 -i0 -p113 mpfr_sqrt mpfr_sqrt mpfr_sqrt
+ mpfr_sqrt: 75 / 80.27 / 88
2021-02-15 Vincent Lefèvre <vincent@vinc17.net>
- [src/jyn_asympt.c] Fixed bug when s=0 at the end of the for loop.
[tests/mpfr-test.h] Added mpfr_cmp_si_2exp0 macro (check NaN).
- [tests/tj1.c] Added testcase.
- (merged changesets r14431,14434 from the trunk)
+ [tests/tj1.c] Replaced mpfr_cmp_si_2exp by mpfr_cmp_si_2exp0.
+
+ [tests/tdigamma.c] Use mpfr_cmp_ui0 to detect NaN.
+
+ [src/digamma.c] Use MPFR_NOTZERO instead of !MPFR_IS_ZERO.
+
+2021-02-15 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/jyn_asympt.c] fixed bug when s=0 at the end of the for loop
+ [tests/tj1.c] added corresponding non-regression test
- [src/digamma.c] Fixed a bug in mpfr_digamma_reflection.
- [tests/tdigamma.c] Added testcase.
- (merged changesets r14430,14432-14433 from the trunk)
+ [src/digamma.c] fixed a bug in mpfr_digamma_reflection when the approximations
+ of Digamma(1-x) and Pi*cot(Pi*x) cancel exactly
+ [tests/tdigamma.c] added corresponding non-regression test
+
+ renamed mpfr_compound to mpfr_compound_si, since in C2X, compoundn takes
+ an intmax_t and not a long, thus we can later implement mpfr_compoundn
+ taking as input an intmax_t
2021-02-10 Vincent Lefèvre <vincent@vinc17.net>
- [src/jyn_asympt.c] Fixed bug when sin(z)±cos(z) rounds to 0.
- [tests/tj0.c] Testcase.
- (merged changesets r14400,14405 from the trunk)
+ [tests/texpm1.c] Improved special tests.
- [src/digamma.c] Fixed bug in mpfr_digamma_positive when t-u is zero.
- [tests/tdigamma.c] Testcase.
- (merged changesets r14399,14401-14404 from the trunk)
+2021-02-09 Paul Zimmermann <Paul.Zimmermann@inria.fr>
- [src/digamma.c] Fixed bug in mpfr_digamma: if x is large, the
- intermediate precision can be large. This issue may still occur,
- but with a very low probability.
- [tests/tdigamma.c] Testcase.
- (merged changesets r14391-14398 from the trunk)
+ [src/pow_sj.c] removed spurious comment
2021-02-09 Vincent Lefèvre <vincent@vinc17.net>
- [src,tests] Consistency: in prototypes, changed
- const mpfr_t to mpfr_srcptr,
- mpfr_t to mpfr_ptr,
- mpz_t to mpz_ptr,
- mpfr_random_deviate_t to mpfr_random_deviate_ptr,
- in order to silence a warning from the future GCC 11 -Warray-parameter
- option (included in -Wall).
-
- This warning was making the MPFR build fail in combination with -Werror
- (useful for testing), and there was no simple way to get rid of it in a
- way independent of the GCC version (due to GCC bug 86134 / 99014, which
- could also silently change the detected features in configure tests).
- And as this inconsistency was also present in mpfr.h, this fix may also
- benefit the build of software that uses MPFR.
-
- (merged changesets r14103,14154 from the trunk)
+ [src/{pow_sj.c,pow_uj.c}] Added missing "#ifdef _MPFR_H_HAVE_INTMAX_T".
+
+ [doc/mpfr.texi] General cleanup, in particular related to the IEEE 754
+ standard. Added IEEE Standard 754-2019 to the references.
+
+ [src/pow_{si,sj,ui,uj}.c] Fixed logging for mpfr_pow_{sj,uj}.
+
+ [src/pow_uj.c] untabify
+
+ [tests/tpow.c] Replaced mpfr_cmp_ui by versions that can detect NaN.
+ Note: this is particularly important to check that pow(NaN,0) returns 1,
+ not NaN.
+
+ [src/pow_uj.c] Some corrections in the mpfr_mpz_set_uj helper function,
+ still with limitations (which could be avoided by sharing code with
+ mpfr_set_uj_2exp).
+
+2021-02-09 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ forgot to commit those files
+
+ added mpfr_powr
+
+2021-02-09 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/{pow_si.c,pow_ui.c}] untabify
+
+2021-02-09 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ added mpfr_pow_uj and mpfr_pow_sj
+ now mpfr_pown is an alias for mpfr_pow_sj
+
+2021-02-09 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi,src/mpfr.h] Added a FIXME for mpfr_pown, which should
+ be an alias of mpfr_pow_sj (not implemented yet) to follow ISO C2x,
+ where pown is defined with intmax_t n.
+
+2021-02-09 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ added mpfr_pown (alias for mpfr_pow_si)
+
+2021-02-08 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr.h] Updated comments on the types for mpfr_prec_t/mpfr_exp_t.
+
+ * For mpfr_prec_t, removed the comment saying that under Windows 64,
+ "long long" could be used (this would imply that mpfr_prec_t and
+ mpfr_exp_t will not fit in a long, and this is not supported yet,
+ see below).
+
+ * For mpfr_exp_t and _MPFR_EXP_FORMAT == 4, changed an unclear note
+ and added other information; in particular, this value is currently
+ not supported since the MPFR code assumes that mpfr_exp_t fits in a
+ long.
+
+2021-02-08 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests] Added texp2m1 and texp10m1 to svn:ignore property.
+
+ [src/jyn_asympt.c] Use mpfr_set4 instead of mpfr_set or mpfr_neg.
+
+ [tests/tj0.c] Latest test: also check the flags.
+
+ [src/digamma.c] Added a comment about the bug fixed in r14399.
+
+ [tests/tdigamma.c] Latest test: also check the flags.
+
+ [tests/tdigamma.c] Moved the r14399 test to its own test function.
+ Note: for this one, there is no need to use the maximum exponent range.
+
+ [src/digamma.c] Use MPFR_NOTZERO instead of !MPFR_IS_ZERO.
+
+2021-02-08 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/jyn_asympt.c] fixed bug when sin(z)+cos(z) or sin(z)-cos(z) round to 0
+ [tests/tj0.c] added corresponding non-regression test
+
+ [src/digamma.c] fixed bug in mpfr_digamma_positive when t-u is zero
+ [tests/tdigamma.c] added corresponding non-regression test
+
+2021-02-08 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/digamma.c] Fix: increased GUARD from 20 to 30.
+ [tests/tdigamma.c] Added 2 precisions for which GUARD=20 is not
+ sufficient, yielding a "too much memory" error.
+
+2021-02-07 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/digamma.c] Punctuation in a comment.
+
+2021-02-07 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/digamma.c] fixed bug20210206
+
+2021-02-06 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/digamma.c] Added a FIXME for mpfr_digamma_positive: q can be
+ too large, e.g. equal to the maximum exponent!
+
+ [src/digamma.c] In mpfr_digamma_positive, log the value of q.
+
+ [src/digamma.c] In mpfr_digamma_positive, do not compute the precision q
+ until we are certain that it will be used.
+
+ [src/digamma.c] In mpfr_digamma_positive, added an assertion, as a
+ precision is set from the exponent of x, and I suppose that it may
+ be larger than MPFR_PREC_MAX when mpfr_exp_t > mpfr_prec_t.
+
+ [tests/tdigamma.c] Added testcase for a bug found by test_generic.
+
+ [tests/tgeneric.c] Added debug info.
+
+2021-02-05 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/exp2m1.c] Use block-level flags.
+
+2021-02-05 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ added new function mpfr_exp10m1
+
+ [tests/texp2m1.c] added a test for exact values
+
+2021-02-05 Vincent Lefèvre <vincent@vinc17.net>
+
+ [TODO] Added mpfr_mul_uj and mpfr_mul_sj.
+
+ [src/log.c] Optimization: avoid a temporary variable for a*2^m;
+ use an alias to a instead. In corner cases, this could yield a
+ new internal TMD for the mpfr_div when the precision of a is
+ very large, but this is avoided by changing the RNDN to RNDF.
+ The error bound of 2 ulp on the mpfr_div should still be valid
+ (it should now actually be 1 ulp).
+
+2021-02-05 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ added new function mpfr_exp2m1 for 2^x-1
+
+2021-02-05 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tversion.c] Fixed length modifier in error messages.
+
+ [src/log10p1.c] In mpfr_log10p1_small: an "else" case is better than
+ a "goto"; do not initialize inex to an arbitrary value.
+
+ [src/compound.c] Exact cases: additional detail in the comment.
+
+ [src/compound.c] Exact cases: this is simpler without a separate
+ function (the t = 0 was artificial). Added full explanations.
+
+2021-02-05 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/compound.c] removed FIXME corresponding to previous commit
+
+ [src/compound.c] fixed infinite loop for exact results like compound(0.5,2)
+ which are not powers of 2
+
+2021-02-05 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/compound.c] Fixed 2 issues with mpfr_compound_near_one:
+ * this function must be called in the extended exponent range,
+ to be sure that 1 is representable;
+ * it wasn't setting the inexact flag, and this is now done via
+ mpfr_check_range.
+
+ [src/compound.c] Added missing MPFR_ZIV_FREE before the "return" in
+ the Ziv loop.
+
+ [tests/tcompound.c] Added generic tests with n = 2 and n = 3.
+ They trigger a failure: bad inexact flag for mpfr_compound2.
+
+ [src/compound.c] Added a FIXME: possible infinite loop when the result
+ is exact.
+
+ [src/compound.c] Optimize the easy case n = 1.
+
+ [src/compound.c] Special cases: fixed compound(-Inf,0) and improved
+ comments.
+
+ [tests/tcompound.c] More tests of compound(x,n) for x < -1, showing
+ a failure on compound(-Inf,0).
+
+ [doc/README.dev] Note that the logging feature (--enable-logging)
+ needs GCC to build MPFR, and it is not available with mini-gmp,
+ since mpfr_fprintf cannot be defined with mini-gmp.
+
+2021-02-04 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tcompound.c] Fixed a test in the case mpfr_exp_t < long.
+
+ [tests/tcompound.c] Corrected an error message.
+
+ [src/compound.c] Fixed bug found by clang:
+ compound.c:32:29: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand]
+ if (rnd_mode == MPFR_RNDN || MPFR_RNDF
+ ^ ~~~~~~~~~
+
+ [tests/tatan2u.c] Fixed a bug (as of C99, for *decimal* constants, one
+ must use a suffix that contains "U" if the constant cannot be signed).
+
+ [tests/tcompound.c] Corrected the conditions of a test for machines
+ with 32-bit long. Added comments.
+
+ [tests] Added tlog10p1 to svn:ignore property.
+
+ [tests/tatan2u.c] Improved comment in bug20210203 about type sizes.
+
+ [tests/tatan2u.c] Make sure that the bug20210203 test is run only
+ when the value for u is representable.
+
+2021-02-04 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [TODO] added section number
+
+ [src/compound.c] fixed case n < 0 and underflow
+ [tests/tcompound.c] added corresponding non-regression tests
+
+ compound(NaN,0) is 1
+
+2021-02-04 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/compound.c] Correction for n = LONG_MIN. Added FIXMEs.
+
+2021-02-04 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tcompound.c] fixed comment
+
+2021-02-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/atan2u.c] fixed error analysis
+
+2021-02-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/compound.c] Portability.
+
+ [tests/tatan2u.c] Make sure that 64-bit constants are supported before
+ using one.
+
+ [src/log10p1.c] Improved checking / debugging support.
+
+2021-02-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tatan2u.c] added a test which currently fails
+
+ [src/log2p1.c] added note about underflow
+
+ added a new function mpfr_log10p1 to compute log10(1+x)
+
+ [tests/tlog2p1.c] set the precision locally to one test
+
+ [doc/mpfr.texi] document atan2u and atan2pi
+
+2021-02-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Typography.
+
+ [doc/mpfr.texi] In Section "Added Functions", do not put the patchlevel
+ in MPFR versions (changed "4.2.0" to "4.2").
+
+ [src/log2p1.c] Bug fix: memory accessed after it is cleared.
+
+ [src/log2p1.c] More logging.
+
+2021-02-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [doc/mpfr.texi] document mpfr_compound
+
+2021-02-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/set_prec.c] Log the precision.
+
+2021-02-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/compound.c] completed the general case
+ [tests/tcompound.c] added one hard-coded test
+
+2021-02-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests] Added tcompound and tlog2p1 to svn:ignore property.
+
+ [tests/tlog2p1.c] Use mpfr_cmp_si0 to detect NaN.
+
+ [tests/tcompound.c] Do not use mpfr_printf in the tests.
+
+2021-02-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/log2p1.c] use ULSIZE as in atan2u.c
+
+ [src/atan2u.c] better explain the choice of prec in mpfr_atan2u_aux3
+
+2021-02-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/compound.c] Fixed logging.
+
+2021-02-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/atan2u.c] simplified code
+
+2021-02-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/atan2u.c] Support unsigned long != 64-bit type. Avoid a warning.
+
+2021-02-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tlog2p1.c] added tests for exact cases
+
+ added log2p1 and compound (mpfr_compound is not finished yet)
+
+ [src/log1p.c] fixed comment
+
+ [src/atan2u.c] deal with underflow and overflow in y/x
+
+2021-02-03 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/atan2u.c] Added a FIXME: the code is incorrect if y/x yields
+ an overflow or an underflow.
+
+ [src/atan2u.c] Fixed 2 bugs in mpfr_atan2u_aux2. Minor changes.
+
+ [src/atan2u.c] Minor corrections in comments.
+
+2021-02-02 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests] Added tatan2u and tatanu to svn:ignore property.
+
+ [tests/tatan2u.c] Do not use mpfr_printf in the tests.
+
+ [src/atan2u.c] Use MPFR_RET_NEVER_GO_HERE.
+
+ [tests]
+ * tgeneric.c: cleanup about the type of the arguments; added support
+ for functions with 3 arguments (x1,x2,u), such as mpfr_atan2u.
+ * tatan2u.c: enabled the generic tests (test_generic).
+
+2021-02-02 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/atan2u.c] fixed atan2u with respect to the four quadrants
+ [tests/tatan2u.c] added corresponding non-regression tests
+
+ added mpfr_atan2u (work in progress)
+
+ [src/atanu.c] fixed bug for u=0
+ [tests/tatanu.c] added non-regression test case
+
+2021-02-02 Vincent Lefèvre <vincent@vinc17.net>
+
+ Changed "plus/minus infinity" to "positive/negative infinity".
+
+ [tools/mpfrlint] In the "+/- infinity" test (just added), also check
+ the doc/algorithms.tex file.
+
+ [tools/mpfrlint] Added a test for the use of "plus/minus infinity"
+ instead of "positive/negative infinity".
+
+ [doc/mpfr.texi] Minor corrections related to infinity. The IEEE 754-2019
+ standard says "positive/negative infinity", not "plus/minus infinity".
+
+2021-02-01 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Typos.
+
+ [{src,tests}/Makefile.am] Untabified values of variables to avoid
+ wrapping in diffs on 80 columns.
+
+2021-02-01 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [TODO] asinpi, acospi and atanpi are done (and their *u variants)
+
+ [src/atanu.c] added comment
+
+ [src/acosu.c] simplified the code when x is tiny
+
+ added mpfr_atanu and mpfr_atanpi
+
+2021-02-01 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Correction about mpfr_get_* and NaN.
+
+2021-02-01 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/asinu.c] improved a comment
+
+ [src/asinu.c] fixed typo
+
+ [src/asinu.c] resolved FIXME
+ [tests/tasinu.c] added more underflow tests
+
+2021-02-01 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/set_ld.c] Replaced a useless goto.
+
+ Code readability.
+
+2021-02-01 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/set_ld.c] added comment about LONGDOUBLE_NAN_ACTION
+
+2021-02-01 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Typography.
+
+ [doc/mpfr.texi] Updated the month.
+
+2021-02-01 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/get_ld.c] forgot get_ld in previous commit
+
+ make it clear that we don't propagate the sign bit in mpfr_get_d and mpfr_set_d
+ and similar functions for binary32, decimal64 and binary128
+
+ added asinu and asinpi
+
+ [src/asinu.c] return NaN for u=0 and |x| > 1
+ [tests/tasinu.c] added more tests
+
+ [src/acosu.c] for u=0 and |x| > 1, return NaN
+ [tests/tacosu.c] added corresponding test
+
+2021-01-31 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests] Use RND_LOOP.
+ Changes with:
+ perl -pi -e 's/^( *)for *\((\w+) *= *0 *; *\2 *< *MPFR_RND_MAX *; *\2 *\+\+\) *$/\1RND_LOOP (\2)/' *.c
+
+ [tests] Added tacosu and tasinu to svn:ignore property.
+
+ [tests/mpfr-test.h] Added mpfr_cmp_si0 macro (check NaN).
+ [tests/tasinu.c] Replaced mpfr_cmp_ui / mpfr_cmp_si by the ...0 version.
+
+ [tests/tasinu.c] Replaced mpfr_cmp by !mpfr_equal_p.
+
+ [tests/tacosu.c] Replaced mpfr_cmp by !mpfr_equal_p.
+
+ [tests/tacosu.c] Fixed failing test with --with-mini-gmp
+ and -DMINI_GMP_LIMB_TYPE=int under Linux/x86_64.
+
+ [tools/mpfrlint] Detect the use of mpfr_set_emin / mpfr_set_emax
+ when set_emin / set_emax could be used (checking failures).
+
+ [tests/tdiv.c] Use set_emax rather than mpfr_set_emax with a test.
+
+ [tests/*.c] When not in a test, use set_emin and set_emax rather than
+ mpfr_set_emin and mpfr_set_emax, in order to check failures.
+ Done with: perl -pi -e 's/^ *\Kmpfr_(set_e(min|max) *\()/\1/' *.c
+
+ [tests/tests.c] Improved error message in set_emin / set_emax to
+ better support platforms where mpfr_exp_t > long int.
+
+ [tests/tcot.c] Use set_emin and set_emax rather than mpfr_set_emin and
+ mpfr_set_emax with a test (test done in set_emin / set_emax).
+
+ [src/{acosu.c,asinu.c,cosu.c,sinu.c,tanu.c}] Typos in comments.
+
+ [tests/tasinu.c] Use set_emin rather than mpfr_set_emin.
+
+2021-01-31 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/acosu.c] fixed case x=-1/2 which was wrong
+ [tests/tacosu.c] added test cases
+
+2021-01-30 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tacosu.c] reduced number of generic tests
+ [tests/tasinu.c] likewise
+
+ [src/asinu.c] fixed case x=-1 and underflow case
+ [tests/tasinu.c] added test for underflow
+
+2021-01-29 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ added asinu (work in progress, not yet usable)
+
+ [doc/mpfr.texi] improve description of mpfr_acosu
+
+ [src/acosu.c] fixed another typo
+
+ [src/acosu.c] fixed typo
+
+2021-01-29 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/acosu.c] Simplified code.
+
+ [tests/tgeneric.c] Added a cast for printf.
+
+ [tests/tgeneric.c] Corrected indentation.
+
+ [tests/tgeneric.c] Corrected indentation.
+
+2021-01-29 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ added cosu and cospi in the manual and NEWS
+
+ new function mpfr_acosu (still to be added in NEWS and mpfr.texi)
+
+2021-01-29 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/{cosu.c,sinu.c,tanu.c}] Function logging: added missing u.
+
+ [TODO] LIA-2 URL after redirection (i.e. https).
+
+2021-01-29 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [TODO] added pointer to LIA-2
+
+2021-01-26 Vincent Lefèvre <vincent@vinc17.net>
+
+ [INSTALL,doc/update-faq,tools/announce-text] With wget, use
+ the --no-config option as the user's .wgetrc file may significantly
+ change the behavior and possibly yield errors. See discussion at
+ <https://lists.debian.org/debian-user/2021/01/msg01021.html>.
+
+2021-01-20 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [TODO] update about powr, rootn and rsqrt
+
+ [TODO] update about reserved cr_xxx names from C standard
+
+2021-01-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/{cosu.c,sinu.c,tanu.c}] Range reduction: improved a test, renamed
+ a variable (e to p, as this is more like a precision), and updated
+ comments, making the code and comments similar for these 3 functions.
+
+ Added function logging for mpfr_fmod_ui and mpfr_sqrt_ui.
+
+2021-01-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/memory.c] Call "fflush (NULL)" before abort() in order to flush
+ all the output streams, in particular the log file (when there is one),
+ so that setting MPFR_LOG_FLUSH (which may be inefficient) is not needed
+ to debug tests that end with a memory error.
+
+ This fixes a regression with glibc 2.27+: the streams are no longer
+ flushed by abort(), as permitted by POSIX; see the abort(3) man page.
+
+2021-01-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src] Fixed typo in mpfr_printf format from MPFR_LOG_FUNC for several
+ functions.
+
+ [doc/mpfr.texi] Completed mpfr_fmod_ui description.
+
+ [src/cosu.c] Fixed bug when the reduced argument is 0.
+
+ [tests/tcosu.c] Added tests that give a reduced argument equal to 0.
+
+ [src/cosu.c] Fixed memory leak with very small reduced arguments.
+
+2021-01-14 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tcosu.c] increase nmax in test_generic call
+ [tests/tsinu.c] likewise
+ [tests/ttanu.c] likewise
+
+2021-01-13 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/{tcosu.c,tsinu.c,ttanu.c}] For the generic tests, no need
+ to reduce emax any longer, now that the fast range reduction has
+ been implemented.
+
+ [src/tanu.c] Implemented range reduction for mpfr_tanu.
+
+ [src/{cosu.c,sinu.c}] Corrected the position of a comment.
+
+ [src/cosu.c] Implemented range reduction for mpfr_cosu.
+
+2021-01-13 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/sinu.c] removed FIXME (done)
+
+2021-01-13 Vincent Lefèvre <vincent@vinc17.net>
+
+ [NEWS,doc/mpfr.texi] For the new trigonometric functions mpfr_cosu,
+ mpfr_sinu, mpfr_tanu, mpfr_cospi, mpfr_sinpi, mpfr_tanpi, removed the
+ "experimental" mention. In mpfr.texi, also added missing functions to
+ Section "Added Functions" (API Compatibility).
+
+ [doc/mpfr.texi] Style consistency: more "[unsigned] long int"
+ instead of just "[unsigned] long".
+
+ [doc/mpfr.texi] Style: use always "[unsigned] long int" in prototypes
+ rather than sometimes just "[unsigned] long".
+
+ [NEWS,doc/mpfr.texi] New function mpfr_fmod_ui.
+
+2021-01-13 Vincent Lefèvre <vincent@vinc17.net>
+
+ Implemented range reduction for mpfr_sinu (and defined mpfr_fmod_ui).
+
+ This is done by computing x mod u; and a new function mpfr_fmod_ui
+ has been defined for this purpose. As mpfr_fmod_ui could be useful
+ to the user, its declaration is put in src/mpfr.h, with the intent
+ to document this new function later.
+
+ In the src directory:
+ * Added fmod_ui.c file (mpfr_fmod_ui function) based on sqrt_ui.c
+ (hence the same copyright line).
+ * Makefile.am: added fmod_ui.c to libmpfr_la_SOURCES.
+ * mpfr.h: added mpfr_fmod_ui.
+ * sinu.c: implemented range reduction for mpfr_sinu.
+
+2021-01-13 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tsinu.c] Added tests where x/u is a "big" integer, so that
+ the reduced argument is 0 (exactly).
+
+ [tests/tsinu.c] Added a test on a large input such that x mod u may need
+ more precision than x. This will be important to test range reduction.
+
+ [src/sqrt_ui.c] Coding style.
+
+ [src/{cosu.c,sinu.c,tanu.c}] Changed MPFR_PREC to MPFR_GET_PREC.
+
+2021-01-12 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/{tcosu.c,tsinu.c,ttanu.c}] C90 compatibility for the tests with
+ large inputs (added in r14236). Also avoid the hardcoded size by using
+ the numberof() macro.
+
+2021-01-12 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tcosu.c] added hard-coded tests with large inputs
+ [tests/tsinu.c] likewise
+ [tests/ttanu.c] likewise
+
+2021-01-05 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/set_ld.c] added pointer to "double double" format
+
+2021-01-04 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc] Updated FAQ.html with update-faq.
2021-01-03 Vincent Lefèvre <vincent@vinc17.net>
@@ -977,58 +3128,444 @@
" ".($1||"$2-").($2+1)/e' **/*(^/)
under zsh. Removed 2020 from the example in the doc/README.dev file.
-2020-09-28 Vincent Lefèvre <vincent@vinc17.net>
+ [src/mpfr-impl.h] Removed a now useless test on __clang__, corresponding
+ to a bug fixed in Clang 3.4 (see <https://bugs.debian.org/705583>).
+
+2020-12-20 Vincent Lefèvre <vincent@vinc17.net>
+
+ Optimize mpfr_abs, mpfr_copysign and mpfr_setsign in the case of reused
+ argument, like what was already done for mpfr_neg: one can just set the
+ sign and handle NaN instead of calling mpfr_set4.
+ Completed tests/tcopysign.c to test with a reused argument.
+
+ [src/cosu.c] Avoid a possible integer overflow (triggered by the tests
+ with UBsan) from r14225.
+
+2020-12-18 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ fixed initial precision in sinu, cosu and tanu
+ also in cosu, treat special case when 2*pi*x/u is small
+
+2020-12-17 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tgeneric.c] Removed the use of __func__ as it is not supported
+ by ISO C90 (it was not really useful here, though).
+
+ [tests/tcosu.c] Increased the maximum precision for test_generic and
+ added a comment about this.
+
+ [tests] Added tcosu, tsinu and ttanu to svn:ignore property.
+
+ For the generic tests, output the number of normal cases and the total
+ if the MPFR_TGENERIC_STAT environment variable is defined.
+ Added description to the README.dev file.
+
+ [tests/tcosu.c] Increased the number of generic tests. This should make
+ the warning "Too few normal cases in generic tests" much less common.
+
+ [tests]
+ * Added data/tan2pi: hardest-to-round cases of tanu with u = 1
+ in double precision, interval [0,1/4].
+ * ttanu.c: test tan2pi values with u = 1.
+
+ [tests/ttanu.c] C89 compatibility.
+
+2020-12-16 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Removed spurious blank line; .texi source reformat.
+
+ [doc/mpfr.texi] Typography: "resp." must be followed by "@:".
+
+ [doc/check-typography] Also check "resp.".
+
+ [doc/mpfr.texi] Removed misplaced @tie{}.
+
+2020-12-16 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [doc/mpfr.texi] fixed another typo
+
+ [doc/mpfr.texi] fixed typos
+
+ added sinpi, cospi, tanpi
+
+ added new function mpfr_tanu
+
+ [src/sinu.c] improved comment
+
+2020-12-15 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/sinu.c] added reference
+
+ [src/sinu.c] fixed compiler warning
+ [src/cosu.c] deal with other exact cases
+ [tests/tcosu.c] added tests for other exact cases
+
+ [src/sinu.c] fixed bug in detection of pi/6 and friends
+
+2020-12-15 Vincent Lefèvre <vincent@vinc17.net>
+
+ [NEWS] mpfr_cosu and mpfr_sinu: improved item.
+
+2020-12-15 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tsinu.c] added more tests
+
+ [src/sinu.c] fixed case where 2xpi/u is +/-pi/6 mod pi
+ [tests/tsinu.c] added corresponding test case
+
+2020-12-15 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests]
+ * Added data/{cos2pi,sin2pi}: hardest-to-round cases of cosu and sinu
+ with u = 1 in double precision, interval [0,1/2].
+ * tcosu.c, tsinu.c: test cos2pi and sin2pi values with u = 1.
+
+ [tests/tests.c] test5rm(): mention test5rm in the error message.
+
+ [src/{cosu.c,sinu.c}] Added function logging.
+
+2020-12-15 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ added new function mpfr_cosu
+
+ [src/sinu.c] fixed typo in comment
+
+ [tests/tsinu.c] fixed typos in comments
+
+2020-12-15 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/sin_cos.c] Code improvement:
+ * replaced a MPFR_PREC(c) by m since the precision of c was set to m;
+ * as a consequence, the initial precision of xr in the Ziv loop will
+ always be m (whether expx >= 2 or not), so that one can use this
+ precision for the mpfr_init2.
+
+2020-12-15 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/sinu.c] forgot to count the rounding error in mpfr_sin (t, t, MPFR_RNDA)
+
+ [src/sinu.c] fixed issue with case t=0
+
+2020-12-15 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/{sin.c,sin_cos.c}]
+ * Do not initialize variables with the default precision, which
+ could have been set to a large value by the user; this would
+ be a waste of memory.
+ * In sin.c, do not initialize xr in the case where this variable
+ will not be used (in sin_cos.c, let's initialize it with the
+ minimum precision as it is used with different purposes).
+
+ [src/{ai.c,yn.c}] Do not initialize variables with the default
+ precision, which could have been set to a large value by the
+ user; this would be a waste of memory.
+
+ [tools/mpfrlint] Added a test to detect when mpfr_init or mpfr_inits is
+ used, i.e. when a variable is initialized with the default precision.
+ This should not be done as the default precision could have been set to
+ a large value by the user, so that this is a waste of memory.
+
+ [src/sinu.c] Correction: variables must not be initialized with the
+ default precision, which could have been set to a large value by the
+ user, and this would be a waste of memory.
+
+2020-12-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/sinu.c] Fixed 2 bugs:
+ * in case of underflow, the flags were not set;
+ * mpfr_odd_p(t) could be called with t = 0, which is unsupported.
+
+2020-12-14 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/sinu.c] fixed typo (thanks Jeffrey Sarnoff)
+
+2020-12-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/sinu.c] Added a FIXME: the range reduction should be done in this
+ function (that's the whole point of sinu compared to sin, besides a
+ smaller rounding error).
+
+ [tests/tsinu.c] Added a FIXME concerning the size of the exponent.
+
+ [doc/mpfr.texi] Typographic correction of math formulas.
+
+ [doc/mpfr.texi] mpfr_sinu: corrections and improvements.
+
+ [doc/mpfr.texi] Updated the month.
+
+2020-12-14 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [NEWS] added mpfr_sinu
+ [doc/mpfr.texi] improve documentation of mpfr_sinu, and say it is experimental
+
+ added mpfr_sinu (work in progress)
+
+2020-12-13 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/zeta.c] Minor correction of a comment.
+
+2020-12-02 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr.h] Added a comment about Intel's compiler ICC and the
+ unsupported returns_nonnull attribute.
+
+2020-11-15 Vincent Lefèvre <vincent@vinc17.net>
+
+ [TODO] Added an item to add "const" in prototypes in the manual.
+
+ [doc/mpfr.texi] mpfr_subnormalize: define EXP(x) and PREC(x).
+
+ [doc/mpfr.texi] More detailed beginning of "Nomenclature and Types",
+ which now specifies the convention for the significand and the exponent.
+
+ [doc/mpfr.texi] Updated the month.
+
+ [doc/mpfr.texi] Document the mpfr_srcptr type.
+
+2020-10-28 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/talloc-cache.c] Check that malloc() doesn't return a null pointer
+ (in order to avoid an error with GCC's -fanalyzer, dev version).
+
+2020-10-23 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/invert_limb.h] Added a comment about r14171.
+
+ [src/invert_limb.h] Fixed potential issues introduced in 14170.
+ * The code isn't valid with 16-bit int (allowed by ISO C). So,
+ make sure with MPFR_STAT_STATIC_ASSERT that unsigned int is
+ large enough for invert_limb_table2.
+ Note: since the code is under "#if GMP_NUMB_BITS == 64",
+ this is unlikely to affect any system in practice, as
+ GMP_NUMB_BITS == 32 (or 16, if supported) should be better
+ on such a system.
+ * Make sure that the "<< 11" shifts do not overflow.
+
+2020-10-23 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/invert_limb.h] patch from Alexei Sibidanov, which reduces memory usage,
+ without degrading performance
+
+2020-10-23 Vincent Lefèvre <vincent@vinc17.net>
- [src/set_z_exp.c] Fixed overflow/underflow detection in exponent ranges
- where emax < 0 or emin >= 0 (bug introduced in r14147).
- [tests/tset_z_exp.c] Added some tests in a reduced exponent range for
- the bug fixed here (and improved existing tests).
- Note: this bug was detected with mini-gmp (for which mpfr_set_z_2exp is
- used more often because a long does not fit into a limb).
- (merged changesets r14146-14150 of src/set_z_2exp.c and
- tests/tset_z_2exp.c from the trunk)
+ [doc/README.dev] Replaced WG14 N2405 reference by the new N2579.
+
+2020-10-21 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr-impl.h] Updated UBF comment about aliasing rules.
+
+ [src/mpfr-impl.h] Updated UBF comment about aliasing rules.
+
+ [src/mpfr-impl.h] Updated UBF comment about aliasing rules.
+
+2020-10-19 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated mpfr_rootn_ui description about "agree with
+ the rootn function", now that IEEE 754-2019 is there (needed as
+ rootn was underspecified in IEEE 754-2008, so that TS 18661-4
+ incorrectly specified the case rootn(-inf, n even); see WG14 N2309
+ from the C FP group for the correction).
+
+2020-10-09 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ fixed typo
+
+2020-10-08 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/README.dev] Added a note about _Float128 vs long double.
+
+ [src/mpfr-impl.h] Added a TODO for the numberof() macro: make it a
+ constant expression and possibly change its type "long" to "ptrdiff_t".
+
+ [doc/mpfr.texi] Minor changes in Section "Formatted Output Functions".
+
+ [NEWS] Update.
+
+ [doc/mpfr.texi] Section "API Compatibility", formatted output functions
+ (mpfr_printf, etc.): completed r14155.
+
+ [doc/mpfr.texi] Updated the month.
+
+ [src/vasprintf.c] Improved comment for READ_INT.
+
+2020-10-07 Vincent Lefèvre <vincent@vinc17.net>
+
+ Fixed the formatted output functions (mpfr_printf, etc.) in the case
+ the precision consists only of a period.
+ * doc/mpfr.texi: correction and clarifications (be closer to ISO C);
+ note the change in Section "API Compatibility".
+ * src/vasprintf.c: fixed the bug.
+ * tests/tsprintf.c: update.
+
+2020-10-07 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src] Consistency: in prototypes, changed
+ mpz_t to mpz_ptr (mpfr-impl.h, pool.c);
+ mpfr_random_deviate_t to mpfr_random_deviate_ptr (random_deviate.c).
+
+ Note: This completes the changes I had done in r14103 (2020-08-21) for
+ mpfr_t. This time, the issue was detected by a GCC 11 snapshot, thanks
+ to the -Warray-parameter option (included in -Wall), which was added
+ on 2020-09-19 in GCC commit 6450f07388f9fe575a489c9309c36012b17b88b0.
+
+2020-10-07 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/vasprintf.c] Updated a comment.
+
+ Added tests/gen-printf-dot-prec Perl script to generate a .c file
+ showing printf and mpfr_printf output with:
+ * a missing precision field;
+ * a precision field with just a period (".");
+ * a precision field with an explicit precision 0 (".0").
+
+2020-09-27 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tset_z_2exp.c] Fixed typo detected by GCC.
+
+ [src/set_z_2exp.c] Fixed overflow/underflow detection in exponent ranges
+ where emax < 0 or emin >= 0 (bug introduced in r14145).
+
+ [tests/tset_z_2exp.c] Added some tests in a reduced exponent range (and
+ improved existing tests).
+ Note: Due to an incorrect change in set_z_2exp.c r14145, various tests
+ are failing with mini-gmp (for which mpfr_set_z_2exp is used more often
+ because a long does not fit into a limb) in unusual exponent ranges. So
+ such tests were obviously missing in tset_z_2exp.c before this commit.
2020-09-25 Vincent Lefèvre <vincent@vinc17.net>
- [src/set_z_exp.c] Fixed possible integer overflows with huge mpz_t.
- Note: In practice, they may occur only with a 32-bit ABI. Moreover,
- with a usual compilation, they should have no effect, assuming the
- processor does signed addition and multiplication mod 2^32 (as usual).
- However, UBsan will detect the issue, and LTO might have unpredictable
- effects.
+ [src/set_z_2exp.c] Fix: avoid possible integer overflows.
- [tests/tset_z_exp.c] Added testcases, enabled only when the
- MPFR_CHECK_LARGEMEM environment variable is set.
+ [tests/tset_z_2exp.c] Test a result.
- (merged changesets r14136-14145 of src/set_z_2exp.c and
- tests/tset_z_2exp.c from the trunk)
+ [doc/README.dev] Added how to convert an unsigned integer to the
+ corresponding signed integer with the two's complement rule (i.e.
+ modular arithmetic) but in a portable way.
-2020-09-17 Vincent Lefèvre <vincent@vinc17.net>
+ [tests] Updated svn:ignore property due to the rename in r14125.
+
+2020-09-24 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tset_z_2exp.c] Added another test that fails with just
+ "-m32 -fsanitize=undefined -fno-sanitize-recover".
+ This corresponds to what is described in the FIXME in src/set_z_2exp.c
+ (about the modified tnrandom.c test yielding an integer overflow).
+
+ [tests/tset_z_2exp.c] Added a test that triggers an integer overflow
+ in set_z_2exp.c with MPFR_CHECK_LARGEMEM=1 when MPFR is compiled with
+ "-m32 -fsanitize=undefined -fno-sanitize-recover -D_MPFR_EXP_FORMAT=4"
+ in CFLAGS:
+ set_z_2exp.c:71:26: runtime error: signed integer overflow:
+ 134217726 * 32 cannot be represented in type 'long int'
+
+2020-09-23 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/exp2.c] Added support for -D_MPFR_EXP_FORMAT=4 in the 32-bit ABI,
+ i.e. 32-bit long, so that the MPFR compilation no longer fails due to
+ a static assertion in this file. Note: many tests fail (not texp2),
+ but at least this allows some testing of various functions.
+
+2020-09-23 Vincent Lefèvre <vincent@vinc17.net>
+
+ [INSTALL] Update concerning MinGW and the __USE_MINGW_ANSI_STDIO macro.
+
+ The change done in r13668 seems to be a bit wrong (at least unclear).
+ This was done after finding
+ https://fr.osdn.net/projects/mingw/lists/archive/users/2019-January/000199.html
+ saying that __USE_MINGW_ANSI_STDIO became deprecated, during a
+ discussion on the vsnprintf() behavior:
+ https://gmplib.org/list-archives/gmp-bugs/2020-January/004716.html
+
+ However, it seems that printf() conformity issues have completely been
+ resolved only recently, in version 8.
+ http://mingw-w64.org/doku.php says:
+ Version 8 has been released
+ v8.0.0: 2020-09-18
+ Notable changes:
+ [...]
+ * __USE_MINGW_ANSI_STDIO now automatically enabled in C99 and C11
+ mode when not using UCRT by Pali Rohár
+ [...]
+
+ Compiling
+ #include <stdio.h>
+ int main (void) { volatile double d = -1.25; printf ("%e\n", d); }
+ gives with mingw-w64 version 7: -1.250000e+000
+ and with mingw-w64 version 8: -1.250000e+00
+
+ So, when testing MPFR with mingw-w64 version 8 but with GMP still built
+ with mingw-w64 version 7 (and static libraries), one gets a failure in
+ tsprintf:
+ Error in mpfr_vsprintf (s, "%e", ...);
+ expected: "-1.250000e+00"
+ got: "-1.250000e+000"
+ because the expected result has changed (it comes from sprintf used in
+ the MPFR test, which is now ISO-compliant).
+
+2020-09-18 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/set_z_2exp.c] Added a FIXME: possible integer overflow, which
+ can be reproduced with a 32-bit ABI by defining MPFR_PREC_MAX as
+ ((mpfr_prec_t) ((((mpfr_uprec_t) -1) >> 1) - 63)) and in tnrandom.c,
+ using "test_special (MPFR_PREC_MAX);".
+
+2020-09-16 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
[doc/mini-gmp] Say that the build with mini-gmp may require ISO C99+
features (as "long long" is currently needed by src/get_ld.c in the
case GMP_NUMB_BITS == 8).
- (merged changeset r14131 from the trunk)
+
+ For consistency, changed "C89" to "C90" in comments of *.{c,h} files.
+
+ [doc/mpfr.texi] Changed C89 to C90, as when mentioning ISO, one must
+ say C90 (C89 is the ANSI version). The GCC manual uses "C90" rather
+ than "C89", so this is probably better anyway.
[src/get_ld.c] Bug fix with GMP_NUMB_BITS == 8 (thus mini-gmp) and
32-bit long (e.g. with -m32 on x86_64).
- (merged changeset r14127 from the trunk)
2020-09-15 Vincent Lefèvre <vincent@vinc17.net>
- [src/random_deviate.c] Fixed non-portable code.
- (merged changesets r14123-14124 from the trunk)
+ Renamed some .c files for consistency:
+ src/get_z_exp.c → src/get_z_2exp.c
+ src/set_z_exp.c → src/set_z_2exp.c
+ tests/tset_z_exp.c → tests/tset_z_2exp.c
+ and updated src/Makefile.am and tests/Makefile.am files.
+
+ [src/random_deviate.c] The latest change r14123 was actually incorrect:
+ the real issue was non-portable code (with an incorrect comment) to
+ convert an unsigned integer to a signed, negative integer. Incorrect
+ behavior could occur with some C implementations and/or when mpfr_exp_t
+ does not have the same size as long. So, fixed this portability issue,
+ and avoid an assertion failure in a very rare case.
+
+ [src/random_deviate.c] Corrected an assertion. → Test failures.
+
+ [tests/tests.c] Added a note about tests done in "src/init2.c".
+
+ [src/init2.c] Check that __MPFR_EXP_MAX == MPFR_EXP_MAX too.
+
+ [tests/tget_z.c] Updated comment to mention that mpfr_get_z_2exp is
+ tested by this file.
[src/mpfr-mini-gmp.c] Fixed bug in gmp_urandomb_ui when the parameter n
is equal to the width of unsigned long.
Note: This case occurs in function random_deviate_generate() from
src/random_deviate.c with a 32-bit ABI (thus 32-bit unsigned long)
since n = W, which is defined as 32.
- (merged changeset r14117 from the trunk)
+
+2020-09-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/mpfr-mini-gmp.c] Simplified gmp_randseed_ui (note: the code in
+ r14114 and r14115 was not the intended one due to the wrong variable
+ in srand).
+
+ [src/mpfr-mini-gmp.c] Corrected latest change for gmp_randseed_ui.
With mini-gmp, use the standard rand() and srand() functions instead of
the POSIX (thus less portable) lrand48() and srand48().
- (merged changesets r14114-14116 from the trunk)
2020-09-10 Vincent Lefèvre <vincent@vinc17.net>
@@ -1036,13 +3573,71 @@
Note: this includes URL updates.
Updated URLs.
- (merged changesets r14106-14110 from the trunk)
+
+ [src/sub1sp.c] Updated a URL (http → https).
+
+ [doc/README.dev] Updated URLs.
+
+ [configure.ac] Updated a URL (http → https).
+
+ [configure.ac] Updated a URL concerning the "Intel® C++ Compiler 9.0
+ for Linux Release Notes" (the URL was not archived).
Updated a freebsd.org URL (bug tracker).
- (merged changeset r14104 from the trunk)
+
+2020-08-21 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src,tests] Consistency: in prototypes, changed
+ const mpfr_t to mpfr_srcptr
+ mpfr_t to mpfr_ptr
+ (except for mpfr_t *), as this is equivalent (the array is converted
+ to a pointer) and the mpfr_srcptr/mpfr_ptr form is the usual one.
+
+2020-08-20 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/README.dev] Added a note about "string + integer" expressions.
+
+ [tests/tsprintf.c] Replaced another occurrence of the code triggering
+ the warning "adding 'int' to a string does not append to the string
+ [-Wstring-plus-int]" with Clang (at least with 3.5 and above).
+
+2020-08-20 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ fixed a compiler warning found by Clang 10.0.1 on armv8-a (Samsung S8
+ aarch64-unknown-linux-android):
+
+ tsprintf.c:1613:27: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
+ strcat (buf, ",0" + (j % 3 != 0));
+ ~~~~~^~~~~~~~~~~~~~
+
+2020-08-20 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ fixed a compiler warning found by Clang 10.0.1 on armv8-a (Samsung S8
+ aarch64-unknown-linux-android):
+
+ ./tgeneric.c:208:40: warning: implicit conversion from 'mp_limb_t' (aka 'unsigned long') to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Wimplicit-int-float-conversion]
+ (double) randlimb () / MPFR_LIMB_MAX;
+ ~ ^~~~~~~~~~~~~
+ ../src/mpfr-impl.h:1277:28: note: expanded from macro 'MPFR_LIMB_MAX'
+ #define MPFR_LIMB_MAX ((mp_limb_t) -1)
+ ^~~~~~~~~~~~~~
+
+2020-08-09 Vincent Lefèvre <vincent@vinc17.net>
+
+ [doc/mpfr.texi] Updated the month.
+
+ [doc/mpfr.texi] In the paragraph about cases that are hard to round,
+ also mention potentially exact cases.
2020-07-20 Vincent Lefèvre <vincent@vinc17.net>
+ [doc/README.dev] Added a paragraph on the issue with GCC and
+ conversions between binary and decimal types.
+
+ [src/get_d128.c] Updated FIXME comment (after r14087).
+
+ [src/get_d128.c] Removed unused variable due to r14087.
+
[src/get_d128.c] For the special values, avoid double to _Decimal128
conversions, as for such conversions, GCC generates from 2 to 3 MB in
the shared library when the decimal encoding is BID, and there will be
@@ -1053,52 +3648,66 @@
as the _Decimal128 implementation should follow the IEEE 754 rules.
This commit should avoid a large part of the problem reported at:
https://gforge.inria.fr/tracker/?func=detail&atid=619&aid=21849&group_id=136
- (merged changesets r14087-14088 from the trunk)
-
- [tests] Various corrections for error messages in tests of long double
- (and double).
- * tests.c: Simplified the d_trace and ld_trace functions:
- we do not need a union (with its potentional padding) as
- there are no aliasing issues with unsigned char.
- * tget_ld_2exp.c: Corrected a function call in an error message.
- * tset_ld.c: Fixed mpfr_out_str usage in error messages
- (see the change in r12520).
- (merged changesets r14080-14083 from the trunk)
+
+2020-07-15 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tset_ld.c] Improved an error message.
+
+2020-07-13 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tests.c] Simplified the d_trace and ld_trace functions:
+ we do not need a union (with its potentional padding) as there
+ are no aliasing issues with unsigned char.
+
+ [tests/tset_ld.c] Fixed mpfr_out_str usage in error messages
+ (see the change in r12520).
+
+ [tests/tget_ld_2exp.c] Corrected a function call in an error message.
[examples/version.c] "Compiler:" line: detect TCC (__TINYC__ macro).
- (merged changeset r14079 from the trunk)
+ (merged r14078 from tests/tversion.c)
[tests/tversion.c] "Compiler:" line: detect TCC (__TINYC__ macro).
- (merged changeset r14078 from the trunk)
-2020-07-10 Vincent Lefèvre <vincent@vinc17.net>
-
- [src/Makefile.am] Updated -version-info to 7:1:1 for MPFR 4.1.1.
+2020-07-12 Vincent Lefèvre <vincent@vinc17.net>
- Updated version to 4.1.1-dev.
+ [src/get_d128.c] Updated the FIXME.
- ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC0 svn log -rHEAD:0 -v".
+ [src/get_d128.c] Added a FIXME to work around GCC bug 96173.
- Updated version to 4.1.0.
+2020-07-10 Vincent Lefèvre <vincent@vinc17.net>
- [doc/mpfr.texi] Updated the month.
+ [src/jyn_asympt.c] Added an assertion.
- [src/jyn_asympt.c] Partly solved the slowness of jn(733333,733333).
- [tests/tjn.c] Added tests of jn(73333,73333) and jn(733333,733333),
- enabled only with MPFR_CHECK_EXPENSIVE.
[doc/README.dev] In the MPFR_CHECK_EXPENSIVE description, say that
--enable-assert=full should not be used (too expensive, not needed).
- (merged changesets r14053-14062 from the trunk)
+ [tests/tjn.c] Added a related comment for the expensive bug20200703
+ test (which may take more than 1 hour with --enable-assert=full).
-2020-07-01 Vincent Lefèvre <vincent@vinc17.net>
+ [tests/tjn.c] Corrected indentation.
- ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC0 svn log -rHEAD:0 -v".
+2020-07-03 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [tests/tjn.c] added another test
+
+ [src/jyn_asympt.c] fixed previous commit
+
+ [src/jyn_asympt.c] partly solved the slowness of jn(733333,733333)
+
+2020-07-03 Vincent Lefèvre <vincent@vinc17.net>
- Updated version to 4.1.0-rc2.
+ [src/jyn_asympt.c] Replaced some MPFR_EXP by MPFR_GET_EXP.
- [NEWS] Added an item saying that TLS can safely be (re-)enabled
- on Sparc.
- (merged changeset r14047 from the trunk)
+ [src/jyn_asympt.c] Added a log message.
+
+ [tests/tjn.c] Added testcase for bug reported by Alex Coplan:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96044
+ mpfr_jn is very slow or doesn't terminate on (733333,733333).
+
+2020-07-01 Vincent Lefèvre <vincent@vinc17.net>
+
+ [NEWS] For MPFR 4.1.0, added an item saying that TLS can safely be
+ (re-)enabled on Sparc.
2020-06-29 Vincent Lefèvre <vincent@vinc17.net>
@@ -1108,103 +3717,120 @@
occurs when accessing __gmpfr_flags directly (and the public mpfr.h
header file does not provide any macro that accesses an internal
variable directly). So a workaround for the tests is the best solution.
- (merged changeset r14045 from the trunk)
2020-06-18 Vincent Lefèvre <vincent@vinc17.net>
- Updated version to 4.1.0-dev (due to changes since 4.1.0-rc1).
+ [NEWS] Update for the next release.
-2020-06-18 Vincent Lefèvre <vincent@vinc17.net>
+ [src/mpfr-longlong.h] Mention applied patch (in r14035).
- Merged r14021-14036 from the trunk:
+2020-06-17 Vincent Lefèvre <vincent@vinc17.net>
- r14021:
- [tests] Skip tabort_defalloc1 and tabort_defalloc2 under Valgrind, as
- Valgrind complains due to the large allocation size.
- * mpfr-test.h, tests.c: added tests_run_within_valgrind() function to
- guess whether the test runs within Valgrind.
- * tabort_defalloc1.c, tabort_defalloc2.c: skip the test (exit code 77)
- if this function returns true.
+ [src/mpfr-longlong.h] Applied patch on
+ https://gmplib.org/list-archives/gmp-bugs/2020-June/004807.html
+ to fix add_ssaaaa and sub_ddmmss on arm / aarch64 (after a
+ reverse-merge of r14032 and r13997), in order to resolve
+ https://sympa.inria.fr/sympa/arc/mpfr/2020-06/msg00017.html
+ https://sympa.inria.fr/sympa/arc/mpfr/2020-06/msg00059.html
- r14022-14023:
- [tests/tset_ld.c] In bug_20160907 (tests on subnormals, specific to
- x86 extended precision):
- * Replaced an assertion by a test with detailed output.
- * In case of incorrect result, detect whether Valgrind is used and
- one gets the result obtained with Valgrind due to
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890215
- https://bugs.kde.org/show_bug.cgi?id=421262
- (long double behaves as double); in this case, output a message
- without an error since Valgrind is the only cause of the
- miscalculation.
- * Corrected a value in a test, which did not match the comment.
+ [tests/tcmp_ui.c] Added a comment about a failing test with tcc if
+ one adds tcc support for macros using __builtin_constant_p in mpfr.h
+ by testing __TINYC__.
+ Bug report against tcc: https://savannah.nongnu.org/bugs/?58606
- r14024-14027:
- [src/digamma.c]
- * Replaced some MPFR_EXP / mpfr_get_exp by MPFR_GET_EXP to check that
- the MPFR number has an exponent (i.e. it is not a special value).
- * Added an integer overflow check on a precision.
- * Fixed a bug: an exponent was read while the value could be zero.
+2020-06-16 Paul Zimmermann <Paul.Zimmermann@inria.fr>
- r14028:
- [tests/tdigamma.c] Increase the number of tests.
+ [src/mpfr-longlong.h] disable buggy sub_ddmmss for aarch64
+
+2020-06-15 Vincent Lefèvre <vincent@vinc17.net>
- r14029,14031:
- [doc/mpfr.texi] Specify the range of b for mpfr_get_str_ndigits.
+ [doc/mpfr.texi] Corrected and detailed the description of
+ mpfr_get_str_ndigits.
- r14030:
[src/get_str.c] Since the mpfr_get_str_ndigits function is in the
public API, use MPFR_ASSERTN instead of MPFR_ASSERTD on the condition
on the argument b in order to get an assertion failure (by default)
if this condition is not satisfied.
- r14032,14035-14036:
- [src/mpfr-longlong.h] Applied patch on
- https://gmplib.org/list-archives/gmp-bugs/2020-June/004807.html
- to fix add_ssaaaa and sub_ddmmss on arm / aarch64, in order to resolve
- https://sympa.inria.fr/sympa/arc/mpfr/2020-06/msg00017.html
- https://sympa.inria.fr/sympa/arc/mpfr/2020-06/msg00059.html
+2020-06-15 Paul Zimmermann <Paul.Zimmermann@inria.fr>
- r14034:
- [tests/tcmp_ui.c] Added a comment about a failing test with tcc if
- one adds tcc support for macros using __builtin_constant_p in mpfr.h
- by testing __TINYC__.
- Bug report against tcc: https://savannah.nongnu.org/bugs/?58606
+ [doc/mpfr.texi] specify the range of b for mpfr_get_str_ndigits
+
+2020-06-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [tests/tdigamma.c] Increase the number of tests.
+
+2020-06-14 Paul Zimmermann <Paul.Zimmermann@inria.fr>
+
+ [src/digamma.c] fixed bug found while testing mpfr-4.1.0-rc1
+
+2020-06-14 Vincent Lefèvre <vincent@vinc17.net>
+
+ [src/digamma.c] Added a FIXME.
+
+ [src/digamma.c] Replaced mpfr_get_exp by MPFR_GET_EXP.
+
+ [src/digamma.c]
+ * Replaced some MPFR_EXP by MPFR_GET_EXP to check that the MPFR number
+ has an exponent (i.e. it is not a special value).
+ → Assertion failure in tdigamma (on x86_64).
+ Note: this might be the cause of an unexpected loop (infinite loop?)
+ on a Debian 10.4 POWER9 machine:
+ https://sympa.inria.fr/sympa/arc/mpfr/2020-06/msg00025.html
+ * Added an integer overflow check on a precision.
2020-06-13 Vincent Lefèvre <vincent@vinc17.net>
+ [tests/tset_ld.c] In a test specific to x86 extended precision, in case
+ of incorrect result, detect whether Valgrind is used and one gets the
+ result obtained with Valgrind due to
+ https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890215
+ https://bugs.kde.org/show_bug.cgi?id=421262
+ (long double behaves as double); in this case, output a message without
+ an error since Valgrind is the only cause of the miscalculation.
+
+ [tests/tset_ld.c] bug_20160907 (tests on subnormals):
+ * Replaced an assertion by a test with detailed output.
+ * Corrected a value in a test, which did not match the comment.
+
+ [tests] Skip tabort_defalloc1 and tabort_defalloc2 under Valgrind, as
+ Valgrind complains due to the large allocation size.
+ * mpfr-test.h, tests.c: added tests_run_within_valgrind() function to
+ guess whether the test runs within Valgrind.
+ * tabort_defalloc1.c, tabort_defalloc2.c: skip the test (exit code 77)
+ if this function returns true.
+
+ [configure.ac] Improvements concerning the default CFLAGS with GCC.
+ * Add -Wc++-compat option to CFLAGS with GCC ≥ 4.1 not in C++ mode.
+ Changes based on Bruno Haible's patch suggested at
+ https://sympa.inria.fr/sympa/arc/mpfr/2020-06/msg00008.html
+ (with some autoconf related fixes).
+ * Output the $CFLAGS value that is eventually used.
+
[configure.ac] No longer add -Wc++-compat to CFLAGS when the compiler
is GCC not in C++ mode (reverting the change done in r13406) since this
option is not available before GCC 4.1:
https://sympa.inria.fr/sympa/arc/mpfr/2020-06/msg00008.html
- (merged changeset r14018 from the trunk)
-
-2020-06-13 Vincent Lefèvre <vincent@vinc17.net>
-
- Merged the latest changes from the trunk:
-
- r14012:
- [tests/tfpif.c] Updated comment about the bug detected on AIX.
- r14015:
[doc/mpfr.texi] ACM TOMS article: use the preferred DOI URL.
-2020-06-13 Vincent Lefèvre <vincent@vinc17.net>
-
- Merged the latest changes from the trunk:
+ [tests/tfpif.c] Updated comment about the bug detected on AIX.
- r14008,14010:
[tools/announce-text] For release candidates, automatically adapt the
flow of the text.
- r14009:
[NEWS] Updated mpfr.org URLs (http → https).
+ [tools/announce-text] Better line lengths for release candidates.
+
2020-06-12 Vincent Lefèvre <vincent@vinc17.net>
- Merged the latest changes from the trunk:
+ [README] Added URL of the official GNU MPFR website and a note about the
+ future migration, since InriaForge will shut down in December 2020.
+
+ [tests/tests.c] Removed a useless "#include <errno.h>" (added in r5252,
+ useless since r5253).
- r14003:
[tests/tfpif.c] Fixed a bug (in the test) detected on AIX[*], where
an fclose failed due to a previous read failure. At the same time,
check that a read failure no longer occurs. Note: the read failure
@@ -1212,34 +3838,19 @@
to fail, i.e. we now check that it fails for a good reason.
[*] gcc119.fsffrance.org on the GCC Compile farm.
- r14004:
- [tests/tests.c] Removed a useless "#include <errno.h>" (added in r5252,
- useless since r5253).
-
- r14005:
- [README] Added URL of the official GNU MPFR website and a note about the
- future migration, since InriaForge will shut down in December 2020.
-
-2020-06-12 Vincent Lefèvre <vincent@vinc17.net>
-
- ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC0 svn log -rHEAD:0 -v".
-
- Updated version to 4.1.0-rc1.
-
[tools/update-version] Improved a message.
- (merged changeset r13999 from the trunk)
[src/mpfr-longlong.h] Corrected a comment from GMP's longlong.h, which
makes codespell complain in particular.
- (merged changeset r13997 from the trunk)
[tools/mpfrlint] Improved the __GMP_DECLSPEC test:
* No longer exclude "src/mpfr.h".
* Avoid false positives in "src/mpfr.h" and "src/mpfr-longlong.h".
- (merged changeset r13995 from the trunk)
[doc/mpfr.texi] Updated the month.
+ Updated version to 4.2.0-dev.
+
ChangeLog update with "LC_ALL=en_US.UTF8 TZ=UTC0 svn log -rHEAD:0 -v".
2020-06-11 Vincent Lefèvre <vincent@vinc17.net>
diff --git a/Build/source/libs/mpfr/mpfr-src/INSTALL b/Build/source/libs/mpfr/mpfr-src/INSTALL
index 48fff11b2d9..64e5e5784ba 100644
--- a/Build/source/libs/mpfr/mpfr-src/INSTALL
+++ b/Build/source/libs/mpfr/mpfr-src/INSTALL
@@ -1,4 +1,4 @@
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -30,6 +30,11 @@ MPFR).
0. You first need to install GMP. See <https://gmplib.org/>.
MPFR requires GMP version 5.0.0 or later.
+ You need a C compiler, preferably GCC, but any reasonable compiler should
+ work (C++ compilers should work too, under the condition that they do not
+ break type punning via union).
+ And you need the standard Unix "make" command, plus some other standard
+ Unix utility commands.
1. Extract the files from the archive.
@@ -37,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.1.1/
+ https://www.mpfr.org/mpfr-4.2.0/
which may have additional information. The patches can be applied
with commands like:
- wget --no-config https://www.mpfr.org/mpfr-4.1.1/allpatches
+ wget --no-config https://www.mpfr.org/mpfr-4.2.0/allpatches
patch -N -Z -p1 < allpatches
or
- curl https://www.mpfr.org/mpfr-4.1.1/allpatches | patch -N -Z -p1
+ curl https://www.mpfr.org/mpfr-4.2.0/allpatches | patch -N -Z -p1
(Those instructions are for the GNU patch command, for example
/usr/bin/gpatch on Solaris.)
@@ -387,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.1.1/>,
+ * the MPFR web page for this version <https://www.mpfr.org/mpfr-4.2.0/>,
which lists bugs found in this version and provides some patches.
If the "configure" fails, please check that the C compiler and its
@@ -593,13 +598,12 @@ approach depending on how you intend to use the resulting libraries.
a. Using MinGW
==============
-1 - We advise to use MinGW (http://www.mingw.org/ for 32-bit, and
- https://sourceforge.net/projects/mingw-w64/ for 32- and 64-bit),
- which is simpler and less demanding than Cygwin. Contrary to Cygwin,
- it also provides native Windows code.
+1 - We advise to use Mingw-w64 (https://www.mingw-w64.org/), which is
+ simpler and less demanding than Cygwin. Contrary to Cygwin, it also
+ provides native Windows code.
If you also use MSYS, you should use "make" for MSYS instead of
- the "make" utility from MinGW-W64 or from GCC, which causes the
+ the "make" utility from Mingw-w64 or from GCC, which causes the
following error:
libtool: warning: libobj name 'extract.Tpo -c -o extract.lo extract.lo'
@@ -618,16 +622,22 @@ a. Using MinGW
3 - To avoid using the Microsoft runtime (which might not be conform to ISO C),
you can use the MinGW runtime package (which is an integral part of MinGW).
- With old MinGW versions, you can get an ISO-compliant printf()
- if you compile your application with either '-ansi', '-posix' or
- '-D__USE_MINGW_ANSI_STDIO'. But note that this latter option,
- which was useful in the past (see below) should no longer be used.
+ With MinGW version v8.0.0 and later, the formatted output functions
+ (printf, etc.) are ISO/POSIX-conforming by default; however, this is
+ no longer true if -std=c89 is used at build time. Conversely, with
+ earlier MinGW versions, it is possible to get conforming functions
+ with either '-ansi', '-posix' or '-D__USE_MINGW_ANSI_STDIO'. Note
+ that if there is a conformity mismatch between the options used for
+ the GMP build (from which the MPFR build gets the output) and those
+ used for the MPFR tests, the tsprintf test may fail with one of the
+ errors below. Be careful that a non-conforming output may yield a
+ buffer overflow.
The following applies to old MinGW versions, and may be discouraged
with recent MinGW versions.
In order to have the MPFR formatted output functions based on an
- ISO-compliant printf(), you need to compile GMP (not MPFR) with
+ ISO-conforming printf(), you need to compile GMP (not MPFR) with
CC="gcc -D__USE_MINGW_ANSI_STDIO" (since the standard printf modifiers
%e, %Ld and %td are passed to GMP).
@@ -704,16 +714,23 @@ The relevant build projects are available here:
d. Using the CompCert compiler
==============================
-[this was tested with CompCert 3.7 and MPFR revision 13851 on x86_64-linux]
+[Tested with CompCert 3.10 and MPFR master-11992-f75b0c388 on x86_64-linux]
-CompCert (http://compcert.inria.fr/) is a formally verified compiler.
+CompCert (https://compcert.org/) is a formally verified compiler.
To compile MPFR with CompCert:
-$ ./configure CC=ccomp CFLAGS="-fbitfields -flongdouble -fstruct-passing" --disable-shared
+$ ./configure --disable-shared CC=ccomp CFLAGS="-flongdouble -fstruct-passing"
You also need to unset LD_LIBRARY_PATH, and/or you might need to change
-wl="" into wl="-Wl," in the libtool file.
+wl="" into wl="-Wl," in the libtool file (after running configure).
All tests (make check) should pass (tget_set_d64, tget_set_d128 and
tset_float128 are skipped, since CompCert does not support _Decimal64,
_Decimal128 nor _Float128).
+
+e. Using the Intel OneApi compiler
+==================================
+
+When using the Intel OneApi compiler (icx), one should add -fp-model=strict
+to CFLAGS so that the conversion routines from/to native floating-point
+types (float, double, ...) work properly. Otherwise some tests will fail.
diff --git a/Build/source/libs/mpfr/mpfr-src/Makefile.am b/Build/source/libs/mpfr/mpfr-src/Makefile.am
index bef006fd70d..a15787bc984 100644
--- a/Build/source/libs/mpfr/mpfr-src/Makefile.am
+++ b/Build/source/libs/mpfr/mpfr-src/Makefile.am
@@ -1,4 +1,8 @@
-# Copyright 2000-2022 Free Software Foundation, Inc.
+# Copyright 2000-2023 Free Software Foundation, Inc.
+# Contributed by the AriC and Caramba projects, INRIA.
+
+# This file is part of the GNU MPFR Library.
+
# This Makefile.am is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -44,11 +48,12 @@ nobase_dist_doc_DATA = AUTHORS BUGS COPYING COPYING.LESSER NEWS TODO \
examples/rndo-add.c examples/sample.c examples/threads.c \
examples/version.c
-# Note: Even though tarballs do not normally contain a .git directory,
-# we need to distribute version-ext.sh to avoid a failure in case a
-# tarball is tested from a Git directory (this script is executed by
-# tests/Makefile.am in case of a Git working tree), which happens with
-# "make distcheck", for instance.
+# Note: The version-ext.sh script is normally no longer needed because
+# the output_info code in tests/Makefile.am now executes this script
+# only if $(top_srcdir)/.git exists and is readable, but this should
+# not occur in a tarball (built based on EXTRA_DIST), unless someone
+# has modified it for some reason. But since this script is small, we
+# distribute it just in case it would be used.
EXTRA_DIST = PATCHES VERSION doc/README.dev doc/check-typography doc/mini-gmp \
tools/check_mparam.c tools/ck-clz_tab tools/ck-copyright-notice \
tools/ck-mparam tools/ck-news tools/ck-version-info tools/get_patches.sh \
diff --git a/Build/source/libs/mpfr/mpfr-src/NEWS b/Build/source/libs/mpfr/mpfr-src/NEWS
index ad90390ac99..95208dcc43e 100644
--- a/Build/source/libs/mpfr/mpfr-src/NEWS
+++ b/Build/source/libs/mpfr/mpfr-src/NEWS
@@ -1,4 +1,4 @@
-Copyright 2000-2022 Free Software Foundation, Inc.
+Copyright 2000-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -20,10 +20,27 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
##############################################################################
-Changes from version 4.1.0 to version 4.1.1:
-- Bug fixes (see <https://www.mpfr.org/mpfr-4.1.0/#fixed> and/or the
- ChangeLog file), in particular for macros implementing functions.
-- Improved manual formatting.
+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
+ the behavior of the formatted output functions may be visible, regarded
+ as underspecified behavior or bug fixes (see below).
+- New functions mpfr_cosu, mpfr_sinu, mpfr_tanu, mpfr_acosu, mpfr_asinu,
+ mpfr_atanu and mpfr_atan2u.
+- New functions mpfr_cospi, mpfr_sinpi, mpfr_tanpi, mpfr_acospi, mpfr_asinpi,
+ mpfr_atanpi and mpfr_atan2pi.
+- New functions mpfr_log2p1, mpfr_log10p1, mpfr_exp2m1, mpfr_exp10m1 and
+ mpfr_compound_si.
+- New functions mpfr_fmod_ui, mpfr_powr, mpfr_pown, mpfr_pow_uj, mpfr_pow_sj
+ and mpfr_rootn_si (mpfr_pown is actually a macro defined as an alias for
+ mpfr_pow_sj).
+- Bug fixes.
+ In particular, for the formatted output functions (mpfr_printf, etc.),
+ the case where the precision consists only of a period has been fixed
+ to be like ".0" as specified in the ISO C standard, and the manual has
+ been corrected and clarified.
+ The macros of the custom interface have also been fixed: they now behave
+ like functions (except a minor limitation for mpfr_custom_init_set).
Changes from versions 4.0.* to version 4.1.0:
- The "épinards à la crème" release.
diff --git a/Build/source/libs/mpfr/mpfr-src/README b/Build/source/libs/mpfr/mpfr-src/README
index 8d2e4aab695..ebd4811c388 100644
--- a/Build/source/libs/mpfr/mpfr-src/README
+++ b/Build/source/libs/mpfr/mpfr-src/README
@@ -1,4 +1,4 @@
-Copyright 2000-2022 Free Software Foundation, Inc.
+Copyright 2000-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -76,4 +76,4 @@ You can get the latest source code by Git at Inria GitLab:
In this case, you should read the file "doc/README.dev" in the working tree
or online:
- https://gitlab.inria.fr/mpfr/mpfr/-/blob/4.1/doc/README.dev
+ https://gitlab.inria.fr/mpfr/mpfr/-/blob/4.2/doc/README.dev
diff --git a/Build/source/libs/mpfr/mpfr-src/TODO b/Build/source/libs/mpfr/mpfr-src/TODO
index e0cc228634d..4b1ad9e651c 100644
--- a/Build/source/libs/mpfr/mpfr-src/TODO
+++ b/Build/source/libs/mpfr/mpfr-src/TODO
@@ -1,4 +1,4 @@
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -27,12 +27,21 @@ Table of contents:
6. Miscellaneous
7. Portability
+
##############################################################################
1. Documentation
##############################################################################
- add a description of the algorithms used and a proof of correctness
+- when mp*_srcptr is used in a prototype, add "const" in the prototype
+ in the manual, like what is now done in the GMP manual, i.e.
+ mpfr_srcptr -> const mpfr_t
+ mpz_srcptr -> const mpz_t
+ mpq_srcptr -> const mpq_t
+ mpf_srcptr -> const mpf_t
+
+
##############################################################################
2. Compiler/library detection
##############################################################################
@@ -40,6 +49,7 @@ Table of contents:
- update ICC detection.
* Use only __INTEL_COMPILER instead of the obsolete macro __ICC?
+
##############################################################################
3. Changes in existing functions
##############################################################################
@@ -105,6 +115,10 @@ Table of contents:
4. New functions to implement
##############################################################################
+- cr_xxx functions from https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf
+ (section 7.31.8, page 392):
+ rsqrt (differs from mpfr_rec_sqrt in -0: mpfr_rec_sqrt gives +Inf whereas
+ rsqrt gives -Inf)
- a function to compute the hash of a floating-point number
(suggested by Patrick Pelissier)
- implement new functions from the C++17 standard:
@@ -145,11 +159,15 @@ Table of contents:
GammaD(x) = Gamma(x+1/2)
- new functions of IEEE 754-2008, and more generally functions of the
C binding draft TS 18661-4:
- http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1946.pdf
- Some propositions about rootn: mpfr_rootn_si, mpfr_rootn_sj, mpfr_rootn_z,
- and versions with an unsigned integer: mpfr_rootn_ui (now implemented, as
- similar to mpfr_root) and mpfr_rootn_uj.
+ https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1946.pdf
+ More rootn functions: mpfr_rootn_uj, mpfr_rootn_sj, mpfr_rootn_z.
+- reduction functions and augmented arithmetic functions from IEEE 754-2019.
+ Note: the interface for the augmented arithmetic functions will need to be
+ discussed (suggestion: for augmentedAddition and augmentedSubtraction,
+ where x+y-roundTiesTowardZero(x+y) may be inexact in MPFR, use a spec
+ similar to augmentedMultiplication).
- functions defined in the LIA-2 standard
+ <https://standards.iso.org/ittf/PubliclyAvailableStandards/c024427_ISO_IEC_10967-2_2001(E).zip>
+ minimum and maximum (5.2.2): max, min, max_seq, min_seq, mmax_seq
and mmin_seq (mpfr_min and mpfr_max correspond to mmin and mmax);
+ rounding_rest, floor_rest, ceiling_rest (5.2.4);
@@ -162,10 +180,7 @@ Table of contents:
+ axis_rad (5.3.9.1) if useful in MPFR;
+ cycle (5.3.10.1): rad(2 pi x / u) u / (2 pi) = remr(x, u);
+ axis_cycle (5.3.10.1) if useful in MPFR;
- + sinu, cosu, tanu, cotu, secu, cscu, cossinu, arcsinu, arccosu,
- arctanu, arccotu, arcsecu, arccscu (5.3.10.{2..14}):
- sin(x 2 pi / u), etc.;
- [from which sinpi(x) = sin(Pi*x), ... are trivial to implement, with u=2.]
+ + cotu, secu, cscu, cossinu, arccotu, arcsecu, arccscu (5.3.10.{5..14}):
+ arcu (5.3.10.15): arctan2(y,x) u / (2 pi);
+ rad_to_cycle, cycle_to_rad, cycle_to_cycle (5.3.11.{1..3}).
- From GSL, missing special functions (if useful in MPFR):
@@ -250,9 +265,9 @@ Table of contents:
- functions from ISO/IEC 24747:2009 (Extensions to the C Library,
to Support Mathematical Special Functions).
Standard: https://www.iso.org/standard/38857.html
- Draft: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1292.pdf
- Rationale: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1244.pdf
- See also: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3060.pdf
+ Draft: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1292.pdf
+ Rationale: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1244.pdf
+ See also: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3060.pdf
(similar, for C++).
Also check whether the functions that are already implemented in MPFR
match this standard.
@@ -285,8 +300,8 @@ Table of contents:
Support UBF in mpfr_check_range or add mpfr_ubf_check_range?
Make this available in the API, e.g. for MPC.
-- mpfr_cmp_uj and mpfr_cmp_sj. They would be useful to test MPFR with
- _MPFR_EXP_FORMAT=4.
+- mpfr_cmp_uj, mpfr_cmp_sj, mpfr_mul_uj, mpfr_mul_sj. They would be useful
+ to test MPFR with _MPFR_EXP_FORMAT=4.
- base conversion with the round-trip property using a minimal precision,
such as the to_chars functions from the C++ standard:
@@ -304,6 +319,16 @@ Table of contents:
Text from: https://www.zsh.org/mla/workers/2019/msg01138.html
+ Idea of implementation: The get_str.c code is based on mpn_get_str, so
+ that we would like to do something similar, but mpn_get_str doesn't give
+ any information about the error. So we should request additional digits
+ (a bit like what is done in get_str.c) and compute approximations to the
+ distance (as an mpz_t) between the input and the straddling midpoints,
+ the unit being the weight of the last requested digit. Then deduce the
+ closest string to the input with the fewest digits in the interval (data
+ are approximate, so that it may be impossible to answer, i.e. this needs
+ to be done in a Ziv loop).
+
- Serialization / Deserialization. Suggested by Frédéric Pétrot:
https://sympa.inria.fr/sympa/arc/mpfr/2020-02/msg00006.html
like mpfr_fpif_{import,export}, but with memory instead of file.
@@ -349,10 +374,24 @@ Table of contents:
* Add new mpfr_fpif_export, mpfr_fpif_import, mpfr_fpif_export_mem,
mpfr_fpif_import_mem.
+- Fused divide-add and fused divide-subtract (mpfr_fda, mpfr_fds).
+ Reference: K. Pande, A. Parkhi, S. Jaykar and A. Peshattiwar,
+ "Design and Implementation of Floating Point Divide-Add Fused Architecture",
+ 2015 Fifth International Conference on Communication Systems and Network
+ Technologies, 2015, pp. 797-800, doi: 10.1109/CSNT.2015.179.
+ However, this article does not provide a specification of special values
+ (but the same rules as FMA/FMS could be chosen, based on 1/±0 = ±Inf and
+ 1/±Inf = ±0).
+
+
##############################################################################
5. Efficiency
##############################################################################
+- Fredrik Johansson wrote a new preprint about computing the gamma function,
+ where he claims a speedup of 10 over MPFR at machine precision, and a
+ speedup of 1000 for a first call to gamma at 10000 digits:
+ https://hal.inria.fr/hal-03346642
- Fredrik Johansson reports that mpfr_ai is slow for large arguments: an
asymptotic expansion should be used (once done, remove REDUCE_EMAX from
tests/tai.c and update the description in mpfr.texi).
@@ -486,6 +525,22 @@ Table of contents:
In particular, binary package distributions would benefit from FMV as
only one binary is generated for different processor families.
+- use intrinsics such as _addcarry_u64 (Intel specific) and
+ __builtin_addcll (clang specific) when available
+ (needs a configure test).
+ References:
+ https://software.intel.com/sites/landingpage/IntrinsicsGuide/
+ https://clang.llvm.org/docs/LanguageExtensions.html#multiprecision-arithmetic-builtins
+ https://stackoverflow.com/q/11228855/3782797
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97387
+ https://stackoverflow.com/questions/71600474/difference-between-builtin-addcll-and-addcarry-u64
+ (would be useful for add1sp.c and sub1sp.c).
+
+- reduce the size of the MPFR library generated by GCC by avoiding
+ operations on _Decimal128 in get_d128.c when its encoding is BID
+ (i.e., software implementation). See FIXME in this file.
+
##############################################################################
6. Miscellaneous
@@ -694,13 +749,21 @@ Table of contents:
internal macros if possible, such as MPFR_TMP_INIT1, MPFR_TMP_INIT and
MPFR_ALIAS.
+- add some option to use pkg-config to get the compiler flags associated
+ with GMP ("pkg-config --cflags gmp" / "pkg-config --libs gmp"). It
+ could be one of
+ --with-pkg-config[=<PATH>]
+ --with-pkg-config-path[=<PATH>]
+ See also the autoconf macros.
+ The non-standard CPATH and C_INCLUDE_PATH environment variables need to
+ be unset (only when invoking pkg-config) as a workaround to
+ https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984504
+
##############################################################################
7. Portability
##############################################################################
-- add a web page with results of builds on different architectures
-
- [Kevin about texp.c long strings]
For strings longer than c99 guarantees, it might be cleaner to
introduce a "tests_strdupcat" or something to concatenate literal
@@ -723,3 +786,8 @@ Table of contents:
* have a rule that copies the needed files ("mpfr.h" or they should
be prefixed with "mpfr-") to $(top_builddir)/include;
* use "-I$(top_builddir)/include".
+
+- _Noreturn (from ISO C11) may be replaced by [[noreturn]] in the future:
+ https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf
+ Once this is implemented in compilers, consider it as an alternative
+ (concerned files: acinclude.m4, doc/README.dev and src/mpfr-impl.h).
diff --git a/Build/source/libs/mpfr/mpfr-src/VERSION b/Build/source/libs/mpfr/mpfr-src/VERSION
index 627a3f43a64..6aba2b245a8 100644
--- a/Build/source/libs/mpfr/mpfr-src/VERSION
+++ b/Build/source/libs/mpfr/mpfr-src/VERSION
@@ -1 +1 @@
-4.1.1
+4.2.0
diff --git a/Build/source/libs/mpfr/mpfr-src/acinclude.m4 b/Build/source/libs/mpfr/mpfr-src/acinclude.m4
index 9954677fab0..130e12a597f 100644
--- a/Build/source/libs/mpfr/mpfr-src/acinclude.m4
+++ b/Build/source/libs/mpfr/mpfr-src/acinclude.m4
@@ -1,6 +1,6 @@
dnl MPFR specific autoconf macros
-dnl Copyright 2000, 2002-2022 Free Software Foundation, Inc.
+dnl Copyright 2000, 2002-2023 Free Software Foundation, Inc.
dnl Contributed by the AriC and Caramba projects, INRIA.
dnl
dnl This file is part of the GNU MPFR Library.
@@ -302,22 +302,23 @@ static double get_max (void) { static volatile double d = DBL_MAX; return d; }
fi
dnl Check if subnormal numbers are supported.
-dnl for the binary64 format, the smallest normal number is 2^(-1022)
-dnl for the binary32 format, the smallest normal number is 2^(-126)
-dnl Note: One could double-check with the value of the macros
-dnl DBL_HAS_SUBNORM and FLT_HAS_SUBNORM, when defined (C2x), but
-dnl neither tests would be reliable on implementations with partial
-dnl subnormal support. Anyway, this check is useful only for the
-dnl tests. Thus in doubt, assume that subnormals are not supported,
-dnl in order to disable the corresponding tests (which could fail).
+dnl For the binary64 format, the smallest normal number is 2^(-1022).
+dnl For the binary32 format, the smallest normal number is 2^(-126).
+dnl Do not use the corresponding HAVE_SUBNORM_* macros as they
+dnl are not available when cross-compiling. For the tests, use
+dnl the have_subnorm_* functions if need be.
+dnl Note: "volatile" is needed to avoid -ffast-math optimizations
+dnl (default in icx 2021.2.0, which also sets the FZ and DAZ bits
+dnl of the x86-64 MXCSR register to disregard subnormals).
AC_CACHE_CHECK([for subnormal double-precision numbers],
mpfr_cv_have_subnorm_dbl, [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
int main (void) {
- double x = 2.22507385850720138309e-308;
- fprintf (stderr, "%e\n", x / 2.0);
- return 2.0 * (double) (x / 2.0) != x;
+ volatile double x = 2.22507385850720138309e-308, y;
+ y = x / 2.0;
+ fprintf (stderr, "%e\n", y);
+ return 2.0 * y != x;
}
]])],
[mpfr_cv_have_subnorm_dbl="yes"],
@@ -333,9 +334,10 @@ mpfr_cv_have_subnorm_flt, [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
int main (void) {
- float x = 1.17549435082229e-38;
- fprintf (stderr, "%e\n", x / 2.0);
- return 2.0 * (float) (x / 2.0) != x;
+ volatile float x = 1.17549435082229e-38, y;
+ y = x / 2.0f;
+ fprintf (stderr, "%e\n", (double) y);
+ return 2.0f * y != x;
}
]])],
[mpfr_cv_have_subnorm_flt="yes"],
@@ -392,6 +394,12 @@ fi
dnl Check whether NAN != NAN (as required by the IEEE-754 standard,
dnl but not by the ISO C standard). For instance, this is false with
dnl MIPSpro 7.3.1.3m under IRIX64. By default, assume this is true.
+dnl Note that this test may not detect all issues. For instance, with
+dnl icx 2021.2.0 (and default fast-math), the result depends on whether
+dnl the identifier has internal or external linkage:
+dnl https://community.intel.com/t5/Intel-oneAPI-Base-Toolkit/icx-2021-2-0-bug-incorrect-NaN-comparison-using-an-identifier/m-p/1286869
+dnl TODO: change "NAN == NAN" to "NaN is supported" and rename
+dnl the MPFR_NANISNAN macro?
AC_CACHE_CHECK([if NAN == NAN], mpfr_cv_nanisnan, [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
@@ -507,27 +515,6 @@ static int f (double (*func)(double)) { return 0; }
AC_DEFINE(HAVE_NEARBYINT, 1,[Have ISO C99 nearbyint function])
],[AC_MSG_RESULT(no)])
-dnl Check if _mulx_u64 is provided
-dnl Note: This intrinsic is not standard. We need a run because
-dnl it may be provided but not working as expected (with ICC 15,
-dnl one gets an "Illegal instruction").
-AC_MSG_CHECKING([for _mulx_u64])
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <immintrin.h>
-]], [[
- unsigned long long h1, h2;
- _mulx_u64(17, 42, &h1);
- _mulx_u64(-1, -1, &h2);
- return h1 == 0 && h2 == -2 ? 0 : 1;
-]])],
- [AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_MULX_U64, 1,[Have a working _mulx_u64 function])
- ],
- [AC_MSG_RESULT(no)
- ],
- [AC_MSG_RESULT([cannot test, assume no])
- ])
-
LIBS="$saved_LIBS"
dnl Try to determine the format of double
diff --git a/Build/source/libs/mpfr/mpfr-src/configure.ac b/Build/source/libs/mpfr/mpfr-src/configure.ac
index 8c0a47c6b85..49d559f302a 100644
--- a/Build/source/libs/mpfr/mpfr-src/configure.ac
+++ b/Build/source/libs/mpfr/mpfr-src/configure.ac
@@ -4,7 +4,7 @@ dnl WARNING! C code starting with # (preprocessor directives) must not
dnl be indented!
AC_COPYRIGHT([
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -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.1.1])
+AC_INIT([MPFR],[4.2.0])
dnl AC_CANONICAL_HOST is needed by this configure.ac file.
dnl AC_CANONICAL_TARGET is not explicitly needed, but may be required by
@@ -430,6 +430,15 @@ AC_LANG(C)
dnl AM_PROG_AR is needed so that ar-lib (wrapper for Microsoft lib.exe)
dnl gets installed by "automake -i" (if absent, "automake --warnings=all"
dnl gives a warning).
+dnl However, if GMP chooses a non-default mode (a.k.a. ABI), this test may
+dnl fail. The reason is that GMP provides GMP_CC and GMP_CFLAGS to get the
+dnl right commands to compile (and link?) in the chosen non-default mode,
+dnl but does not provide a macro for the archiver (if such a special command
+dnl is needed). In case of failure, the user needs to either force GMP to
+dnl use the default mode or provide an AR variable for MPFR's configure.
+dnl Example: on power-aix, "gcc -c -O2 -maix64 -mpowerpc64 -mtune=power7"
+dnl is used, but "ar cru" fails. Solution: use AR="ar -X64" NM="nm -B -X64"
+dnl as said in the INSTALL file ("Notes on AIX/PowerPC").
AM_PROG_AR
dnl This must done before MPFR_CONFIGS.
@@ -473,8 +482,6 @@ dnl (__GMP_CFLAGS macro in gmp.h) above. The consequence is that this
dnl might yield a compilation failure if the -Werror option appears in
dnl __GMP_CFLAGS. But in this case, since -Werror is not used by default,
dnl one may expect that the user would also set CFLAGS for MPFR.
-dnl Note: When the compiler is GCC not in C++ mode, -Wc++-compat may be
-dnl interesting, but it has been introduced in GCC 4.1 only.
if test "$test_CFLAGS" != set && test -n "$GCC"; then
CFLAGS="-Wpointer-arith $CFLAGS"
AC_MSG_CHECKING(whether the selected language is C++)
@@ -485,12 +492,20 @@ error
#endif
]], [[]])],[
AC_MSG_RESULT(no)
+ dnl The option -Wc++-compat is available in GCC 4.1.0 and newer.
+ [
+ case `$CC --version | $SED -e 's/^[^ ]* //' -e 's/([^)]*) //' -e 1q` in
+ 2.*|3.*|4.0*) ;;
+ *) CFLAGS="-Wc++-compat $CFLAGS" ;;
+ esac
CFLAGS="-Wmissing-prototypes $CFLAGS"
+ ]
],[
AC_MSG_RESULT(yes)
CFLAGS="-Wmissing-declarations -Wno-sign-compare $CFLAGS"
])
CFLAGS="-Wall $CFLAGS"
+ AC_MSG_NOTICE([using CFLAGS="$CFLAGS"])
fi
AM_PROG_CC_C_O
diff --git a/Build/source/libs/mpfr/mpfr-src/src/Makefile.am b/Build/source/libs/mpfr/mpfr-src/src/Makefile.am
index 22f7f9063a6..ce8efcfb85f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/Makefile.am
+++ b/Build/source/libs/mpfr/mpfr-src/src/Makefile.am
@@ -1,4 +1,8 @@
-# Copyright 2000-2022 Free Software Foundation, Inc.
+# Copyright 2000-2023 Free Software Foundation, Inc.
+# Contributed by the AriC and Caramba projects, INRIA.
+
+# This file is part of the GNU MPFR Library.
+
# This Makefile.am is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,12 +20,12 @@
# other "make" implementations.
.POSIX:
-EXTRA_DIST = round_raw_generic.c jyn_asympt.c \
- add1sp1_extracted.c mul_1_extracted.c sub1sp1_extracted.c \
- amd/mparam.h arm/mparam.h \
- generic/coverage/mparam.h generic/mparam.h \
- mips/mparam.h powerpc64/mparam.h sparc64/mparam.h \
- x86/mparam.h x86_64/core2/mparam.h x86_64/mparam.h
+EXTRA_DIST = round_raw_generic.c jyn_asympt.c \
+ add1sp1_extracted.c mul_1_extracted.c sub1sp1_extracted.c \
+ amd/mparam.h arm/mparam.h \
+ generic/coverage/mparam.h generic/mparam.h \
+ mips/mparam.h powerpc64/mparam.h sparc64/mparam.h \
+ x86/mparam.h x86_64/core2/mparam.h x86_64/mparam.h
include_HEADERS = mpfr.h mpf2mpfr.h
nodist_include_HEADERS =
@@ -31,44 +35,46 @@ BUILT_SOURCES = get_patches.c mparam.h
lib_LTLIBRARIES = libmpfr.la
libmpfr_la_SOURCES = mpfr.h mpf2mpfr.h mpfr-cvers.h mpfr-gmp.h \
-mpfr-impl.h mpfr-intmax.h mpfr-longlong.h mpfr-sassert.h mpfr-thread.h \
-exceptions.c extract.c uceil_exp2.c \
-uceil_log2.c ufloor_log2.c add.c add1.c add_ui.c agm.c clear.c cmp.c \
-cmpabs.c cmp_si.c cmp_ui.c comparisons.c div_2exp.c div_2si.c \
-div_2ui.c div.c div_ui.c dot.c dump.c eq.c exp10.c exp2.c exp3.c exp.c \
-frac.c frexp.c get_d.c get_exp.c get_str.c init.c inp_str.c isinteger.c \
-isinf.c isnan.c isnum.c const_log2.c log.c modf.c mul_2exp.c mul_2si.c \
-mul_2ui.c mul.c mul_ui.c neg.c next.c out_str.c printf.c vasprintf.c \
-const_pi.c pow.c pow_si.c pow_ui.c print_raw.c print_rnd_mode.c \
-reldiff.c round_prec.c set.c setmax.c setmin.c set_d.c set_dfl_prec.c \
-set_exp.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c \
-set_str.c set_str_raw.c set_ui.c set_z.c sqrt.c sqrt_ui.c sub.c sub1.c \
-sub_ui.c rint.c ui_div.c ui_sub.c urandom.c urandomb.c get_z_exp.c \
-swap.c factorial.c cosh.c sinh.c tanh.c sinh_cosh.c acosh.c asinh.c \
-atanh.c atan.c cmp2.c exp_2.c asin.c const_euler.c cos.c sin.c tan.c \
-fma.c fms.c hypot.c log1p.c expm1.c log2.c log10.c ui_pow.c \
-ui_pow_ui.c minmax.c dim.c signbit.c copysign.c setsign.c gmp_op.c \
-init2.c acos.c sin_cos.c set_nan.c set_inf.c set_zero.c powerof2.c \
-gamma.c set_ld.c get_ld.c cbrt.c volatile.c fits_s.h fits_sshort.c \
-fits_sint.c fits_slong.c fits_u.h fits_ushort.c fits_uint.c \
-fits_ulong.c fits_uintmax.c fits_intmax.c get_si.c get_ui.c zeta.c \
-cmp_d.c erf.c inits.c inits2.c clears.c sgn.c check.c sub1sp.c \
-version.c mpn_exp.c mpfr-gmp.c mp_clz_tab.c sum.c add1sp.c \
-free_cache.c si_op.c cmp_ld.c set_ui_2exp.c set_si_2exp.c set_uj.c \
-set_sj.c get_sj.c get_uj.c get_z.c iszero.c cache.c sqr.c \
-int_ceil_log2.c isqrt.c strtofr.c pow_z.c logging.c mulders.c get_f.c \
-round_p.c erfc.c atan2.c subnormal.c const_catalan.c root.c \
-gen_inverse.h sec.c csc.c cot.c eint.c sech.c csch.c coth.c \
-round_near_x.c constant.c abort_prec_max.c stack_interface.c lngamma.c \
-zeta_ui.c set_d64.c get_d64.c jn.c yn.c rem1.c add_d.c \
-sub_d.c d_sub.c mul_d.c div_d.c d_div.c li2.c rec_sqrt.c min_prec.c \
-buildopt.c digamma.c bernoulli.c isregular.c set_flt.c get_flt.c \
-scale2.c set_z_exp.c ai.c gammaonethird.c ieee_floats.h \
+mpfr-impl.h mpfr-intmax.h mpfr-longlong.h mpfr-sassert.h mpfr-thread.h \
+exceptions.c extract.c uceil_exp2.c \
+uceil_log2.c ufloor_log2.c add.c add1.c add_ui.c agm.c clear.c cmp.c \
+cmpabs.c cmp_si.c cmp_ui.c comparisons.c div_2exp.c div_2si.c \
+div_2ui.c div.c div_ui.c dot.c dump.c eq.c exp10.c exp2.c exp3.c exp.c \
+frac.c frexp.c get_d.c get_exp.c get_str.c init.c inp_str.c isinteger.c \
+isinf.c isnan.c isnum.c const_log2.c log.c modf.c mul_2exp.c mul_2si.c \
+mul_2ui.c mul.c mul_ui.c neg.c next.c out_str.c printf.c vasprintf.c \
+const_pi.c pow.c pow_si.c pow_ui.c pow_sj.c pow_uj.c print_raw.c \
+print_rnd_mode.c \
+reldiff.c round_prec.c set.c setmax.c setmin.c set_d.c set_dfl_prec.c \
+set_exp.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c \
+set_str.c set_str_raw.c set_ui.c set_z.c sqrt.c sqrt_ui.c sub.c sub1.c \
+sub_ui.c rint.c ui_div.c ui_sub.c urandom.c urandomb.c get_z_2exp.c \
+swap.c factorial.c cosh.c sinh.c tanh.c sinh_cosh.c acosh.c asinh.c \
+atanh.c atan.c cmp2.c exp_2.c asin.c const_euler.c cos.c sin.c tan.c \
+fma.c fms.c hypot.c log1p.c expm1.c log2.c log2p1.c log10.c log10p1.c \
+ui_pow.c ui_pow_ui.c minmax.c dim.c signbit.c copysign.c setsign.c \
+gmp_op.c init2.c acos.c sin_cos.c set_nan.c set_inf.c set_zero.c \
+powerof2.c gamma.c set_ld.c get_ld.c cbrt.c volatile.c fits_s.h \
+fits_sshort.c fits_sint.c fits_slong.c fits_u.h fits_ushort.c \
+fits_uint.c fits_ulong.c fits_uintmax.c fits_intmax.c get_si.c get_ui.c \
+zeta.c cmp_d.c erf.c inits.c inits2.c clears.c sgn.c check.c sub1sp.c \
+version.c mpn_exp.c mpfr-gmp.c mp_clz_tab.c sum.c add1sp.c \
+free_cache.c si_op.c cmp_ld.c set_ui_2exp.c set_si_2exp.c set_uj.c \
+set_sj.c get_sj.c get_uj.c get_z.c iszero.c cache.c sqr.c \
+int_ceil_log2.c isqrt.c strtofr.c pow_z.c logging.c mulders.c get_f.c \
+round_p.c erfc.c atan2.c atan2u.c subnormal.c const_catalan.c root.c \
+gen_inverse.h sec.c csc.c cot.c eint.c sech.c csch.c coth.c \
+round_near_x.c constant.c abort_prec_max.c stack_interface.c lngamma.c \
+zeta_ui.c set_d64.c get_d64.c jn.c yn.c rem1.c add_d.c \
+sub_d.c d_sub.c mul_d.c div_d.c d_div.c li2.c rec_sqrt.c min_prec.c \
+buildopt.c digamma.c bernoulli.c isregular.c set_flt.c get_flt.c \
+scale2.c set_z_2exp.c ai.c gammaonethird.c ieee_floats.h \
grandom.c fpif.c set_float128.c get_float128.c rndna.c nrandom.c \
random_deviate.h random_deviate.c erandom.c mpfr-mini-gmp.c \
-mpfr-mini-gmp.h fmma.c log_ui.c gamma_inc.c ubf.c invert_limb.h \
+mpfr-mini-gmp.h fmma.c log_ui.c gamma_inc.c ubf.c invert_limb.h \
invsqrt_limb.h beta.c odd_p.c get_q.c pool.c total_order.c set_d128.c \
-get_d128.c nbits_ulong.c cmpabs_ui.c
+get_d128.c nbits_ulong.c cmpabs_ui.c sinu.c cosu.c tanu.c fmod_ui.c \
+acosu.c asinu.c atanu.c compound.c exp2m1.c exp10m1.c powr.c
nodist_libmpfr_la_SOURCES = $(BUILT_SOURCES)
@@ -96,7 +102,8 @@ libmpfr_la_LIBADD = @LIBOBJS@
# 3.1.x 5:x:1
# 4.0.x 6:x:0
# 4.1.x 7:x:1
-libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 7:1:1
+# 4.2.x 8:x:2
+libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 8:0:2
GET_PATCHES_SH = $(top_srcdir)/tools/get_patches.sh
PATCHES = $(top_srcdir)/PATCHES
diff --git a/Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c b/Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c
index 39d478cd0f8..ff3d8be6625 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/abort_prec_max.c
@@ -1,6 +1,6 @@
/* mpfr_abort_prec_max -- Abort due to maximal precision overflow.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/acos.c b/Build/source/libs/mpfr/mpfr-src/src/acos.c
index 2742c6b57a5..ce43a784792 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/acos.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/acos.c
@@ -1,6 +1,6 @@
/* mpfr_acos -- arc-cosinus of a floating-point number
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/acosh.c b/Build/source/libs/mpfr/mpfr-src/src/acosh.c
index aad970bb4be..21ee49950d6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/acosh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/acosh.c
@@ -1,6 +1,6 @@
/* mpfr_acosh -- inverse hyperbolic cosine
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/acosu.c b/Build/source/libs/mpfr/mpfr-src/src/acosu.c
new file mode 100644
index 00000000000..73b67f5ecdf
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/acosu.c
@@ -0,0 +1,169 @@
+/* mpfr_acosu -- acosu(x) = acos(x)*u/(2*pi)
+ mpfr_acospi -- acospi(x) = acos(x)/pi
+
+Copyright 2021-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* put in y the correctly rounded value of acos(x)*u/(2*pi) */
+int
+mpfr_acosu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t tmp, pi;
+ mpfr_prec_t prec;
+ mpfr_exp_t expx;
+ int compared, inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*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,
+ inexact));
+
+ /* Singular cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else /* necessarily x=0 */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ /* acos(0)=Pi/2 thus acosu(0)=u/4 */
+ return mpfr_set_ui_2exp (y, u, -2, rnd_mode);
+ }
+ }
+
+ compared = mpfr_cmpabs_ui (x, 1);
+ if (compared > 0)
+ {
+ /* acosu(x) = NaN for |x| > 1, included for u=0, since NaN*0 = NaN */
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ if (u == 0) /* return +0 since acos(x)>=0 */
+ {
+ MPFR_SET_ZERO (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+
+ if (compared == 0)
+ {
+ /* |x| = 1: acosu(1,u) = +0, acosu(-1,u)=u/2 */
+ if (MPFR_SIGN(x) > 0) /* IEEE-754 2019: acosPi(1) = +0 */
+ return mpfr_set_ui (y, 0, rnd_mode);
+ else
+ return mpfr_set_ui_2exp (y, u, -1, rnd_mode);
+ }
+
+ /* acos(1/2) = pi/6 and acos(-1/2) = pi/3, thus in these cases acos(x,u)
+ is exact when u is a multiple of 3 */
+ if (mpfr_cmp_si_2exp (x, MPFR_SIGN(x), -1) == 0 && (u % 3) == 0)
+ return mpfr_set_si_2exp (y, u / 3, MPFR_IS_NEG (x) ? 0 : -1, rnd_mode);
+
+ prec = MPFR_PREC (y);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* For |x|<0.5, we have acos(x) = pi/2 - x*r(x) with |r(x)| < 1.05
+ thus acosu(x,u) = u/4*(1 - x*s(x)) with 0 <= s(x) < 1.
+ If EXP(x) <= -prec-3, then |u/4*x*s(x)| < u/4*2^(-prec-3) < ulp(u/4)/8
+ <= ulp(RN(u/4))/4, thus the result will be u/4, nextbelow(u/4) or
+ nextabove(u/4).
+ Warning: when u/4 is a power of two, the difference between u/4 and
+ nextbelow(u/4) is only 1/4*ulp(u/4).
+ We also require x < 2^-64, so that in the case u/4 is not exact,
+ the contribution of x*s(x) is smaller compared to the last bit of u. */
+ expx = MPFR_GET_EXP(x);
+ if (expx <= -64 && expx <= - (mpfr_exp_t) prec - 3)
+ {
+ prec = (MPFR_PREC(y) <= 63) ? 65 : MPFR_PREC(y) + 2;
+ /* now prec > 64 and prec > MPFR_PREC(y)+1 */
+ mpfr_init2 (tmp, prec);
+ inexact = mpfr_set_ui (tmp, u, MPFR_RNDN); /* exact since prec >= 64 */
+ MPFR_ASSERTD(inexact == 0);
+ /* for x>0, we have acos(x) < pi/2; for x<0, we have acos(x) > pi/2 */
+ if (MPFR_IS_POS(x))
+ mpfr_nextbelow (tmp);
+ else
+ mpfr_nextabove (tmp);
+ /* Since prec >= 65, the last significant bit of tmp is 1, and since
+ prec > PREC(y), tmp is not representable in the target precision,
+ which ensures we will get a correct ternary value below. */
+ MPFR_ASSERTD(mpfr_min_prec(tmp) > MPFR_PREC(y));
+ /* since prec >= PREC(y)+2, the rounding of tmp is correct */
+ inexact = mpfr_div_2ui (y, tmp, 2, rnd_mode);
+ mpfr_clear (tmp);
+ goto end;
+ }
+
+ prec += MPFR_INT_CEIL_LOG2(prec) + 10;
+
+ mpfr_init2 (tmp, prec);
+ mpfr_init2 (pi, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ /* In the error analysis below, each thetax denotes a variable such that
+ |thetax| <= 2^-prec */
+ mpfr_acos (tmp, x, MPFR_RNDN);
+ /* tmp = acos(x) * (1 + theta1) */
+ mpfr_const_pi (pi, MPFR_RNDN);
+ /* pi = Pi * (1 + theta2) */
+ mpfr_div (tmp, tmp, pi, MPFR_RNDN);
+ /* tmp = acos(x)/Pi * (1 + theta3)^3 */
+ mpfr_mul_ui (tmp, tmp, u, MPFR_RNDN);
+ /* tmp = acos(x)*u/Pi * (1 + theta4)^4 */
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDN); /* exact */
+ /* tmp = acos(x)*u/(2*Pi) * (1 + theta4)^4 */
+ /* since |(1 + theta4)^4 - 1| <= 8*|theta4| for prec >= 2,
+ the relative error is less than 2^(3-prec) */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - 3,
+ MPFR_PREC (y), rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (pi, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, tmp, rnd_mode);
+ mpfr_clear (tmp);
+ mpfr_clear (pi);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
+
+int
+mpfr_acospi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_acosu (y, x, 2, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/add.c b/Build/source/libs/mpfr/mpfr-src/src/add.c
index b3f8b4fba1d..bd5866ef52f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add.c
@@ -1,6 +1,6 @@
/* mpfr_add -- add two floating-point numbers
-Copyright 1999-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/add1.c b/Build/source/libs/mpfr/mpfr-src/src/add1.c
index 78ed4da9eb1..3c99e4ab078 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add1.c
@@ -1,6 +1,6 @@
/* mpfr_add1 -- internal function to perform a "real" addition
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/add1sp.c b/Build/source/libs/mpfr/mpfr-src/src/add1sp.c
index ecd0e3d1de0..00e5f842ce5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add1sp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add1sp.c
@@ -1,7 +1,7 @@
/* mpfr_add1sp -- internal function to perform a "real" addition
All the op must have the same precision
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/add1sp1_extracted.c b/Build/source/libs/mpfr/mpfr-src/src/add1sp1_extracted.c
index 399fa7d170e..2ef88f3aada 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add1sp1_extracted.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add1sp1_extracted.c
@@ -4,7 +4,7 @@
Source: https://github.com/project-everest/hacl-star/tree/dev_mpfr/code/mpfr
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 62db9694926..7adeb5c5350 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add_d.c
@@ -1,7 +1,7 @@
/* mpfr_add_d -- add a multiple precision floating-point number
to a machine double precision float
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 c08df2f7363..6fbeed6192b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/add_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/add_ui.c
@@ -1,6 +1,6 @@
/* mpfr_add_ui -- add a floating-point number with a machine integer
-Copyright 2000-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/agm.c b/Build/source/libs/mpfr/mpfr-src/src/agm.c
index 045ba0a28ac..3239ccca693 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/agm.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/agm.c
@@ -1,6 +1,6 @@
/* mpfr_agm -- arithmetic-geometric mean of two floating-point numbers
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ai.c b/Build/source/libs/mpfr/mpfr-src/src/ai.c
index 67703847c63..aa8e8d91ffa 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ai.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ai.c
@@ -1,6 +1,6 @@
/* mpfr_ai -- Airy function Ai
-Copyright 2010-2022 Free Software Foundation, Inc.
+Copyright 2010-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -188,12 +188,12 @@ mpfr_ai1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
wprec = MPFR_ADD_PREC (prec, t);
}
- mpfr_init (ti);
- mpfr_init (tip1);
- mpfr_init (temp1);
- mpfr_init (temp2);
- mpfr_init (x3);
- mpfr_init (s);
+ mpfr_init2 (ti, wprec);
+ mpfr_init2 (tip1, wprec);
+ mpfr_init2 (temp1, wprec);
+ mpfr_init2 (temp2, wprec);
+ mpfr_init2 (x3, wprec);
+ mpfr_init2 (s, wprec);
/* ZIV loop */
for (;;)
@@ -420,13 +420,13 @@ mpfr_ai2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
z = (mpfr_t *) mpfr_allocate_func ( (L + 1) * sizeof (mpfr_t) );
MPFR_ASSERTN (z != NULL);
for (j=0; j<=L; j++)
- mpfr_init (z[j]);
+ mpfr_init2 (z[j], wprec);
- mpfr_init (s);
- mpfr_init (u0); mpfr_init (u1);
- mpfr_init (result);
- mpfr_init (temp1);
- mpfr_init (temp2);
+ mpfr_init2 (s, wprec);
+ mpfr_init2 (u0, wprec); mpfr_init2 (u1, wprec);
+ mpfr_init2 (result, wprec);
+ mpfr_init2 (temp1, wprec);
+ mpfr_init2 (temp2, wprec);
/* ZIV loop */
for (;;)
@@ -573,7 +573,7 @@ mpfr_ai2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
z = (mpfr_t *) mpfr_allocate_func ( (L + 1) * sizeof (mpfr_t));
MPFR_ASSERTN (z != NULL);
for (j=0; j<=L; j++)
- mpfr_init (z[j]);
+ mpfr_init2 (z[j], wprec);
if (correctBits == 0)
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/amd/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/amd/mparam.h
index a5074fcdb5b..12a5031a5b5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/amd/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/amd/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h
index e7056ec8965..2a7cbd12ab7 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/arm/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/asin.c b/Build/source/libs/mpfr/mpfr-src/src/asin.c
index 4b5287ae2a3..29eae21f775 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/asin.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/asin.c
@@ -1,6 +1,6 @@
/* mpfr_asin -- arc-sinus of a floating-point number
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/asinh.c b/Build/source/libs/mpfr/mpfr-src/src/asinh.c
index 565e322dc3c..831f3fa7904 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/asinh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/asinh.c
@@ -1,6 +1,6 @@
/* mpfr_asinh -- inverse hyperbolic sine
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/asinu.c b/Build/source/libs/mpfr/mpfr-src/src/asinu.c
new file mode 100644
index 00000000000..5c4e968de62
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/asinu.c
@@ -0,0 +1,164 @@
+/* mpfr_asinu -- asinu(x) = asin(x)*u/(2*pi)
+ mpfr_asinpi -- asinpi(x) = asin(x)/pi
+
+Copyright 2021-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* put in y the correctly rounded value of asin(x)*u/(2*pi) */
+int
+mpfr_asinu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t tmp, pi;
+ mpfr_prec_t prec;
+ int compared, inexact;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*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,
+ inexact));
+
+ /* Singular cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else /* necessarily x=0 */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ /* asin(0)=0 with same sign, even when u=0 to ensure
+ asinu(-x,u) = -asinu(x,u) */
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0); /* exact result */
+ }
+ }
+
+ compared = mpfr_cmpabs_ui (x, 1);
+ if (compared > 0)
+ {
+ /* asinu(x) = NaN for |x| > 1, included for u=0, since NaN*0 = NaN */
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ if (u == 0) /* return 0 with sign of x */
+ {
+ MPFR_SET_ZERO (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+
+ if (compared == 0)
+ {
+ /* |x| = 1: asinu(1,u) = u/4, asinu(-1,u)=-u/4 */
+ /* we can't use mpfr_set_si_2exp with -u since -u might not be
+ representable as long */
+ if (MPFR_SIGN(x) > 0)
+ return mpfr_set_ui_2exp (y, u, -2, rnd_mode);
+ else
+ {
+ inexact = mpfr_set_ui_2exp (y, u, -2, MPFR_INVERT_RND(rnd_mode));
+ MPFR_CHANGE_SIGN(y);
+ return -inexact;
+ }
+ }
+
+ /* asin(+/-1/2) = +/-pi/6, thus asin(+/-1/2,u) = +/-u/12 is exact when u is
+ a multiple of 3 */
+ if (mpfr_cmp_si_2exp (x, MPFR_SIGN(x), -1) == 0 && (u % 3) == 0)
+ {
+ long v = u / 3;
+ if (MPFR_IS_NEG (x))
+ v = -v;
+ return mpfr_set_si_2exp (y, v, -2, rnd_mode);
+ }
+
+ prec = MPFR_PREC (y);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ prec += MPFR_INT_CEIL_LOG2(prec) + 10;
+
+ mpfr_init2 (tmp, prec);
+ mpfr_init2 (pi, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ /* In the error analysis below, each thetax denotes a variable such that
+ |thetax| <= 2^(1-prec) */
+ mpfr_asin (tmp, x, MPFR_RNDA);
+ /* tmp = asin(x) * (1 + theta1), and tmp cannot be zero since we rounded
+ away from zero, and the case x=0 was treated before */
+ /* first multiply by u to avoid underflow issues */
+ mpfr_mul_ui (tmp, tmp, u, MPFR_RNDA);
+ /* tmp = asin(x)*u * (1 + theta2)^2, and |tmp| >= 0.5*2^emin */
+ mpfr_const_pi (pi, MPFR_RNDZ); /* round toward zero since we we will
+ divide by pi, to round tmp away */
+ /* pi = Pi * (1 + theta3) */
+ mpfr_div (tmp, tmp, pi, MPFR_RNDA);
+ /* tmp = asin(x)*u/Pi * (1 + theta4)^4, with |tmp| > 0 */
+ /* since we rounded away from 0, if we get 0.5*2^emin here, it means
+ |asinu(x,u)| < 0.25*2^emin (pi is not exact) thus we have underflow */
+ if (MPFR_EXP(tmp) == __gmpfr_emin)
+ {
+ /* mpfr_underflow rounds away for RNDN */
+ mpfr_clear (tmp);
+ mpfr_clear (pi);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y,
+ (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ : rnd_mode, 1);
+ }
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDA); /* exact */
+ /* tmp = asin(x)*u/(2*Pi) * (1 + theta4)^4 */
+ /* since |(1 + theta4)^4 - 1| <= 8*|theta4| for prec >= 3,
+ the relative error is less than 2^(4-prec) */
+ MPFR_ASSERTD(!MPFR_IS_ZERO(tmp));
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - 4,
+ MPFR_PREC (y), rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (pi, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, tmp, rnd_mode);
+ mpfr_clear (tmp);
+ mpfr_clear (pi);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
+
+int
+mpfr_asinpi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_asinu (y, x, 2, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atan.c b/Build/source/libs/mpfr/mpfr-src/src/atan.c
index 0af73a29d03..4220bcbafb8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/atan.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/atan.c
@@ -1,6 +1,6 @@
/* mpfr_atan -- arc-tangent of a floating-point number
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atan2.c b/Build/source/libs/mpfr/mpfr-src/src/atan2.c
index 27814e8f2de..469c84333ff 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/atan2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/atan2.c
@@ -1,6 +1,6 @@
/* mpfr_atan2 -- arc-tan 2 of a floating-point number
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atan2u.c b/Build/source/libs/mpfr/mpfr-src/src/atan2u.c
new file mode 100644
index 00000000000..d5ec829ccb9
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/atan2u.c
@@ -0,0 +1,361 @@
+/* mpfr_atan2u -- atan2u(y,x,u) = atan(|y/x|)*u/(2*pi) for x > 0
+ atan2u(y,x,u) = 1-atan(|y/x|)*u/(2*pi) for x < 0
+ mpfr_atan2pi -- atan2pi(x) = atan2u(u=2)
+
+Copyright 2021-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#define ULSIZE (sizeof (unsigned long) * CHAR_BIT)
+
+/* z <- s*u*2^e, with e between -3 and -1 */
+static int
+mpfr_atan2u_aux1 (mpfr_ptr z, unsigned long u, int e, int s,
+ mpfr_rnd_t rnd_mode)
+{
+ if (s > 0)
+ return mpfr_set_ui_2exp (z, u, e, rnd_mode);
+ else
+ {
+ int inex;
+
+ rnd_mode = MPFR_INVERT_RND (rnd_mode);
+ inex = mpfr_set_ui_2exp (z, u, e, rnd_mode);
+ MPFR_CHANGE_SIGN (z);
+ return -inex;
+ }
+}
+
+/* z <- s*3*u*2^e, with e between -3 and -1 */
+static int
+mpfr_atan2u_aux2 (mpfr_ptr z, unsigned long u, int e, int s,
+ mpfr_rnd_t rnd_mode)
+{
+ int inex;
+ mpfr_t t;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_init2 (t, ULSIZE + 2);
+ inex = mpfr_set_ui_2exp (t, u, e, MPFR_RNDZ); /* exact */
+ MPFR_ASSERTD (inex == 0);
+ inex = mpfr_mul_ui (t, t, 3, MPFR_RNDZ); /* exact */
+ MPFR_ASSERTD (inex == 0);
+ if (s < 0)
+ MPFR_CHANGE_SIGN (t);
+ inex = mpfr_set (z, t, rnd_mode);
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (z, inex, rnd_mode);
+}
+
+/* return round(sign(s)*(u/2-eps),rnd_mode), where eps < 1/2*ulp(u/2) */
+static int
+mpfr_atan2u_aux3 (mpfr_ptr z, unsigned long u, int s, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t t;
+ mpfr_prec_t prec;
+ int inex;
+
+ prec = (MPFR_PREC(z) + 2 > ULSIZE) ? MPFR_PREC(z) + 2 : ULSIZE;
+ /* prec >= PREC(z)+2 and prec >= ULSIZE */
+ mpfr_init2 (t, prec);
+ mpfr_set_ui_2exp (t, u, -1, MPFR_RNDN); /* exact since prec >= ULSIZE */
+ mpfr_nextbelow (t);
+ /* u/2 - 1/4*ulp_p(u/2) <= t <= u/2, where p = PREC(z),
+ which ensures round_p(t) = round_p(u/2-eps) */
+ if (s < 0)
+ mpfr_neg (t, t, MPFR_RNDN);
+ inex = mpfr_set (z, t, rnd_mode);
+ mpfr_clear (t);
+ return inex;
+}
+
+/* return round(sign(y)*(u/4-sign(x)*eps),rnd_mode),
+ where eps < 1/2*ulp(u/4) */
+static int
+mpfr_atan2u_aux4 (mpfr_ptr z, mpfr_srcptr y, mpfr_srcptr x, unsigned long u,
+ mpfr_rnd_t rnd_mode)
+{
+ mpfr_t t;
+ mpfr_prec_t prec;
+ int inex;
+
+ prec = (MPFR_PREC(z) > ULSIZE) ? MPFR_PREC(z) + 2 : ULSIZE + 2;
+ /* prec >= PREC(z)+2 and prec >= ULSIZE + 2 */
+ mpfr_init2 (t, prec);
+ mpfr_set_ui_2exp (t, u, -2, MPFR_RNDN); /* exact */
+ if (MPFR_SIGN(x) > 0)
+ mpfr_nextbelow (t);
+ else
+ mpfr_nextabove (t);
+ if (MPFR_SIGN(y) < 0)
+ mpfr_neg (t, t, MPFR_RNDN);
+ inex = mpfr_set (z, t, rnd_mode);
+ mpfr_clear (t);
+ return inex;
+}
+
+/* deal with underflow case, i.e., when y/x rounds to zero */
+static int
+mpfr_atan2u_underflow (mpfr_ptr z, mpfr_srcptr y, mpfr_srcptr x,
+ unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_exp_t e = MPFR_GET_EXP(y) - MPFR_GET_EXP(x) + (ULSIZE - 1);
+ /* Detect underflow: since |atan(|y/x|)| < |y/x| for |y/x| < 1,
+ |atan2u(y,x,u)| < |y/x|*u/(2*pi) < 2^(ULSIZE-2)*|y/x|
+ < 2^(EXP(y)-EXP(x)+(ULSIZE-1)).
+ For x > 0, we have underflow when
+ EXP(y)-EXP(x)+(ULSIZE-1) < emin.
+ For x < 0, we have underflow when
+ EXP(y)-EXP(x)+(ULSIZE-1) < EXP(u/2)-prec. */
+ if (MPFR_IS_POS(x))
+ {
+ MPFR_ASSERTN(e < __gmpfr_emin);
+ return mpfr_underflow (z,
+ (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ : rnd_mode, MPFR_SIGN(y));
+ }
+ else
+ {
+ MPFR_ASSERTD (MPFR_IS_NEG(x));
+ MPFR_ASSERTN(e < (ULSIZE - 1) - MPFR_PREC(z));
+ return mpfr_atan2u_aux3 (z, u, MPFR_SIGN(y), rnd_mode);
+ }
+}
+
+/* deal with overflow case, i.e., when y/x rounds to infinity */
+static int
+mpfr_atan2u_overflow (mpfr_ptr z, mpfr_srcptr y, mpfr_srcptr x,
+ unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ /* When t goes to +Inf, pi/2 - 1/t < atan(t) < pi/2,
+ thus u/4 - u/(2*pi*t) < atanu(t) < u/4.
+ As soon as u/(2*pi*t) < 1/2*ulp(u/4), the result is either u/4
+ or the number just below.
+ Here t = y/x, thus 1/t <= x/y < 2^(EXP(x)-EXP(y)+1),
+ and u/(2*pi*t) < 2^(EXP(x)-EXP(y)+(ULSIZE-2)). */
+ mpfr_exp_t e = MPFR_GET_EXP(x) - MPFR_GET_EXP(y) + (ULSIZE - 2);
+ mpfr_exp_t ulpz = (ULSIZE - 2) - MPFR_PREC(z); /* ulp(u/4) <= 2^ulpz */
+ MPFR_ASSERTN (e < ulpz - 1);
+ return mpfr_atan2u_aux4 (z, y, x, u, rnd_mode);
+}
+
+/* put in z the correctly rounded value of atan2y(y,x,u) */
+int
+mpfr_atan2u (mpfr_ptr z, mpfr_srcptr y, mpfr_srcptr x, unsigned long u,
+ mpfr_rnd_t rnd_mode)
+{
+ mpfr_t tmp;
+ mpfr_prec_t prec;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("y[%Pu]=%.*Rg x[%Pu]=%.*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,
+ inex));
+
+ /* Special cases */
+ if (MPFR_ARE_SINGULAR (x, y))
+ {
+ if (MPFR_IS_NAN (x) || MPFR_IS_NAN (y))
+ {
+ MPFR_SET_NAN (z);
+ MPFR_RET_NAN;
+ }
+ /* remains (y=Inf,x=Inf), (Inf,0), (Inf,regular), (0,Inf), (0,0),
+ (0,regular), (regular,Inf), (regular,0) */
+ if (MPFR_IS_INF (x))
+ {
+ /* cases (y=Inf,x=Inf), (0,Inf), (regular,Inf) */
+ if (MPFR_IS_INF (y))
+ {
+ if (MPFR_IS_NEG (x))
+ {
+ /* atan2Pi(+/-Inf,-Inf) = +/-3/4,
+ atan2u(+/-Inf,-Inf,u) = +/-3u/8 */
+ return mpfr_atan2u_aux2 (z, u, -3, MPFR_SIGN (y), rnd_mode);
+ }
+ else /* x > 0 */
+ {
+ /* atan2Pi(+/-Inf,-Inf) = +/-1/4,
+ atan2u(+/-Inf,-Inf,u) = +/-u/8 */
+ return mpfr_atan2u_aux1 (z, u, -3, MPFR_SIGN (y), rnd_mode);
+ }
+ }
+ /* remains (y,x) = (0,Inf) and (regular,Inf),
+ in which cases the IEEE 754-2019 rules for (y=0,x<>0)
+ and for (y<>0,x Inf) coincide */
+ if (MPFR_IS_NEG (x))
+ /* y>0: atan2Pi(+/-y,-Inf) = +/-1,
+ atan2u(+/-y,-Inf,u) = +/-u/2 */
+ return mpfr_atan2u_aux1 (z, u, -1, MPFR_SIGN (y), rnd_mode);
+ else
+ {
+ /* y>0: atan2Pi(+/-y,+Inf) = +/-0,
+ atan2u(+/-y,+Inf,u) = +/-0 */
+ MPFR_SET_ZERO (z);
+ MPFR_SET_SAME_SIGN (z, y);
+ MPFR_RET (0);
+ }
+ }
+ /* remains (y=Inf,x=0), (Inf,regular), (0,0), (0,regular), (regular,0) */
+ if (MPFR_IS_INF (y))
+ /* x is zero or regular */
+ /* atan2Pi(+/-Inf, x) = +/-1/2, atan2u(+/-Inf, x, u) = +/-u/4 */
+ return mpfr_atan2u_aux1 (z, u, -2, MPFR_SIGN(y), rnd_mode);
+ /* remains (y=0,x=0), (0,regular), (regular,0) */
+ if (MPFR_IS_ZERO (y))
+ {
+ if (MPFR_IS_NEG (x))
+ {
+ /* atan2Pi(+/-0, x) = +/-1, atan2u(+/-0, x, u) = +/-u/2 */
+ return mpfr_atan2u_aux1 (z, u, -1, MPFR_SIGN(y), rnd_mode);
+ }
+ else /* case x = +0 or x > 0 */
+ {
+ /* atan2Pi(+/-0, x) = +/-0, atan2u(+/-0, x, u) = +/-0 */
+ MPFR_SET_ZERO (z); /* does not modify sign, in case z=y */
+ MPFR_SET_SAME_SIGN (z, y);
+ MPFR_RET (0); /* exact result */
+ }
+ }
+ /* remains (regular,0) */
+ if (MPFR_IS_ZERO (x))
+ {
+ /* y<0: atan2Pi(y,+/-0) = -1/2, thus atan2u(y,+/-0,u) = -u/4 */
+ /* y>0: atan2Pi(y,+/-0) = 1/2, thus atan2u(y,+/-0,u) = u/4 */
+ return mpfr_atan2u_aux1 (z, u, -2, MPFR_SIGN(y), rnd_mode);
+ }
+ /* no special case should remain */
+ MPFR_RET_NEVER_GO_HERE ();
+ }
+
+ /* IEEE 754-2019 says that atan2Pi is odd with respect to y */
+
+ /* now both y and x are regular */
+ if (mpfr_cmpabs (y, x) == 0)
+ {
+ if (MPFR_IS_POS (x))
+ /* atan2u (+/-x,x,u) = +/u/8 for x > 0 */
+ return mpfr_atan2u_aux1 (z, u, -3, MPFR_SIGN(y), rnd_mode);
+ else /* x < 0 */
+ /* atan2u (+/-x,x,u) = -/+3u/8 for x > 0 */
+ return mpfr_atan2u_aux2 (z, u, -3, MPFR_SIGN(y), rnd_mode);
+ }
+
+ if (u == 0) /* return 0 with sign of y for x > 0,
+ and 1 with sign of y for x < 0 */
+ {
+ if (MPFR_SIGN(x) > 0)
+ {
+ MPFR_SET_ZERO (z);
+ MPFR_SET_SAME_SIGN (z, y);
+ MPFR_RET (0);
+ }
+ else
+ return mpfr_set_si (z, MPFR_SIGN(y) > 0 ? 1 : -1, rnd_mode);
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ prec = MPFR_PREC (z);
+ prec += MPFR_INT_CEIL_LOG2(prec) + 10;
+ mpfr_init2 (tmp, prec);
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ mpfr_exp_t expt, e;
+ /* atan2u(-y,x,u) = -atan(y,x,u)
+ atan2u(y,x,u) = atan(|y/x|)*u/(2*pi) for x > 0
+ atan2u(y,x,u) = u/2-atan(|y/x|)*u/(2*pi) for x < 0
+ atan2pi atan2u
+ First quadrant: [0,1/2] [0,u/4]
+ Second quadrant: [1/2,1] [u/4,u/2]
+ Third quadrant: [-1,-1/2] [-u/2,-u/4]
+ Fourth quadrant: [-1/2,0] [-u/4,0] */
+ inex = mpfr_div (tmp, y, x, MPFR_RNDN);
+ if (MPFR_IS_ZERO(tmp))
+ {
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_atan2u_underflow (z, y, x, u, rnd_mode);
+ }
+ if (MPFR_IS_INF(tmp))
+ {
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_atan2u_overflow (z, y, x, u, rnd_mode);
+ }
+ MPFR_SET_SIGN (tmp, 1);
+ expt = MPFR_GET_EXP(tmp);
+ /* |tmp - |y/x|| <= e1 := 1/2*ulp(tmp) = 2^(expt-prec-1) */
+ inex |= mpfr_atanu (tmp, tmp, u, MPFR_RNDN);
+ /* the derivative of atan(t) is 1/(1+t^2), thus that of atanu(t) is
+ u/(1+t^2)/(2*pi), and if tmp2 is the new value of tmp, we have
+ |tmp2 - atanu|y/x|| <= 1/2*ulp(tmp2) + e1*u/(1+tmp^2)/4 */
+ e = (expt < 1) ? 0 : expt - 1;
+ /* max(1,|tmp|) >= 2^e thus 1/(1+tmp^2) <= 2^(-2*e) */
+ e = expt - 2 * e + MPFR_INT_CEIL_LOG2(u) - 2;
+ /* now e1*u/(1+tmp^2)/4 <= 2^(e-prec-1) */
+ /* |tmp2 - atanu(y/x)| <= 1/2*ulp(tmp2) + 2^(e-prec-1) */
+ e = (e < MPFR_GET_EXP(tmp)) ? MPFR_GET_EXP(tmp) : e;
+ /* |tmp2 - atanu(y/x)| <= 2^(e-prec) */
+ if (MPFR_SIGN (x) < 0)
+ { /* compute u/2-tmp */
+ mpfr_mul_2ui (tmp, tmp, 1, MPFR_RNDN); /* error <= 2^(e+1-prec) */
+ mpfr_ui_sub (tmp, u, tmp, MPFR_RNDN);
+ expt = MPFR_GET_EXP(tmp);
+ /* error <= 2^(expt-prec-1) + 2^(e+1-prec) */
+ e = (expt - 1 > e + 1) ? expt - 1 : e + 1;
+ /* error <= 2^(e+1-prec) */
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDN);
+ /* error <= 2^(e-prec) */
+ }
+ /* both with x>0 and x<0, we have error <= 2^(e-prec),
+ now we want error <= 2^(expt-prec+err)
+ thus err = e-expt */
+ e -= MPFR_GET_EXP(tmp);
+ if (MPFR_SIGN(y) < 0) /* atan2u is odd with respect to y */
+ MPFR_CHANGE_SIGN(tmp);
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - e,
+ MPFR_PREC (z), rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (tmp, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+ inex = mpfr_set (z, tmp, rnd_mode);
+ mpfr_clear (tmp);
+ MPFR_SAVE_EXPO_FREE (expo);
+
+ return mpfr_check_range (z, inex, rnd_mode);
+}
+
+int
+mpfr_atan2pi (mpfr_ptr z, mpfr_srcptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_atan2u (z, y, x, 2, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atanh.c b/Build/source/libs/mpfr/mpfr-src/src/atanh.c
index 5cae1feaba5..20cac085b26 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/atanh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/atanh.c
@@ -1,6 +1,6 @@
/* mpfr_atanh -- Inverse Hyperbolic Tangente
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/atanu.c b/Build/source/libs/mpfr/mpfr-src/src/atanu.c
new file mode 100644
index 00000000000..780213c9c5a
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/atanu.c
@@ -0,0 +1,189 @@
+/* mpfr_atanu -- atanu(x) = atan(x)*u/(2*pi)
+ mpfr_atanpi -- atanpi(x) = atan(x)/pi
+
+Copyright 2021-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* put in y the correctly rounded value of atan(x)*u/(2*pi) */
+int
+mpfr_atanu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_t tmp, pi;
+ mpfr_prec_t prec;
+ mpfr_exp_t expx;
+ int inex;
+ MPFR_SAVE_EXPO_DECL (expo);
+ MPFR_ZIV_DECL (loop);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*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,
+ inex));
+
+ /* Singular cases */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x))
+ {
+ /* atanu(+Inf,u) = u/4, atanu(-Inf,u) = -u/4 */
+ if (MPFR_IS_POS (x))
+ return mpfr_set_ui_2exp (y, u, -2, rnd_mode);
+ else
+ {
+ inex = mpfr_set_ui_2exp (y, u, -2, MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (y);
+ return -inex;
+ }
+ }
+ else /* necessarily x=0 */
+ {
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
+ /* atan(0)=0 with same sign, even when u=0 to ensure
+ atanu(-x,u) = -atanu(x,u) */
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0); /* exact result */
+ }
+ }
+
+ if (u == 0) /* return 0 with sign of x, which is coherent with case x=0 */
+ {
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+
+ if (mpfr_cmpabs_ui (x, 1) == 0)
+ {
+ /* |x| = 1: atanu(1,u) = u/8, atanu(-1,u)=-u/8 */
+ /* we can't use mpfr_set_si_2exp with -u since -u might not be
+ representable as long */
+ if (MPFR_SIGN(x) > 0)
+ return mpfr_set_ui_2exp (y, u, -3, rnd_mode);
+ else
+ {
+ inex = mpfr_set_ui_2exp (y, u, -3, MPFR_INVERT_RND(rnd_mode));
+ MPFR_CHANGE_SIGN(y);
+ return -inex;
+ }
+ }
+
+ /* For x>=1, we have pi/2-1/x < atan(x) < pi/2, thus
+ u/4-u/(2*pi*x) < atanu(x,u) < u/4, and the relative difference between
+ atanu(x,u) and u/4 is less than 2/(pi*x) < 1/x <= 2^(1-EXP(x)).
+ If the relative difference is <= 2^(-prec-2), then the difference
+ between atanu(x,u) and u/4 is <= 1/4*ulp(u/4) <= 1/2*ulp(RN(u/4)).
+ We also require x >= 2^64, which implies x > 2*u/pi, so that
+ (u-1)/4 < u/4-u/(2*pi*x) < u/4. */
+ expx = MPFR_GET_EXP(x);
+ if (expx >= 65 && expx - 1 >= MPFR_PREC(y) + 2)
+ {
+ prec = (MPFR_PREC(y) <= 63) ? 65 : MPFR_PREC(y) + 2;
+ /* now prec > 64 and prec > MPFR_PREC(y)+1 */
+ mpfr_init2 (tmp, prec);
+ /* since expx >= 65, we have emax >= 65, thus u is representable here,
+ and we don't need to work in an extended exponent range */
+ inex = mpfr_set_ui (tmp, u, MPFR_RNDN); /* exact since prec >= 64 */
+ MPFR_ASSERTD(inex == 0);
+ mpfr_nextbelow (tmp);
+ /* Since prec >= 65, the last significant bit of tmp is 1, and since
+ prec > PREC(y), tmp is not representable in the target precision,
+ which ensures we will get a correct ternary value below. */
+ MPFR_ASSERTD(mpfr_min_prec(tmp) > MPFR_PREC(y));
+ if (MPFR_SIGN(x) < 0)
+ MPFR_CHANGE_SIGN(tmp);
+ /* since prec >= PREC(y)+2, the rounding of tmp is correct */
+ inex = mpfr_div_2ui (y, tmp, 2, rnd_mode);
+ mpfr_clear (tmp);
+ return inex;
+ }
+
+ prec = MPFR_PREC (y);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ prec += MPFR_INT_CEIL_LOG2(prec) + 10;
+
+ mpfr_init2 (tmp, prec);
+ mpfr_init2 (pi, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ /* In the error analysis below, each thetax denotes a variable such that
+ |thetax| <= 2^(1-prec) */
+ mpfr_atan (tmp, x, MPFR_RNDA);
+ /* tmp = atan(x) * (1 + theta1), and tmp cannot be zero since we rounded
+ away from zero, and the case x=0 was treated before */
+ /* first multiply by u to avoid underflow issues */
+ mpfr_mul_ui (tmp, tmp, u, MPFR_RNDA);
+ /* tmp = atan(x)*u * (1 + theta2)^2, and |tmp| >= 0.5*2^emin */
+ mpfr_const_pi (pi, MPFR_RNDZ); /* round toward zero since we we will
+ divide by pi, to round tmp away */
+ /* pi = Pi * (1 + theta3) */
+ mpfr_div (tmp, tmp, pi, MPFR_RNDA);
+ /* tmp = atan(x)*u/Pi * (1 + theta4)^4, with |tmp| > 0 */
+ /* since we rounded away from 0, if we get 0.5*2^emin here, it means
+ |atanu(x,u)| < 0.25*2^emin (pi is not exact) thus we have underflow */
+ if (MPFR_EXP(tmp) == __gmpfr_emin)
+ {
+ /* mpfr_underflow rounds away for RNDN */
+ mpfr_clear (tmp);
+ mpfr_clear (pi);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y,
+ (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ : rnd_mode, 1);
+ }
+ mpfr_div_2ui (tmp, tmp, 1, MPFR_RNDA); /* exact */
+ /* tmp = atan(x)*u/(2*Pi) * (1 + theta4)^4 */
+ /* since |(1 + theta4)^4 - 1| <= 8*|theta4| for prec >= 3,
+ the relative error is less than 2^(4-prec) */
+ MPFR_ASSERTD(!MPFR_IS_ZERO(tmp));
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (tmp, prec - 4,
+ MPFR_PREC (y), rnd_mode)))
+ break;
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (tmp, prec);
+ mpfr_set_prec (pi, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inex = mpfr_set (y, tmp, rnd_mode);
+ mpfr_clear (tmp);
+ mpfr_clear (pi);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inex, rnd_mode);
+}
+
+int
+mpfr_atanpi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_atanu (y, x, 2, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/bernoulli.c b/Build/source/libs/mpfr/mpfr-src/src/bernoulli.c
index facda28c535..7b32515251b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/bernoulli.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/bernoulli.c
@@ -1,6 +1,6 @@
/* bernoulli -- internal function to compute Bernoulli numbers.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/beta.c b/Build/source/libs/mpfr/mpfr-src/src/beta.c
index e4edcd3ac5b..85e8b8934c1 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/beta.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/beta.c
@@ -1,6 +1,6 @@
/* mpfr_beta -- beta function
-Copyright 2017-2022 Free Software Foundation, Inc.
+Copyright 2017-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/buildopt.c b/Build/source/libs/mpfr/mpfr-src/src/buildopt.c
index 17be28129df..f47a054bc22 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/buildopt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/buildopt.c
@@ -1,7 +1,7 @@
/* buildopt.c -- functions giving information about options used during the
mpfr library compilation
-Copyright 2009-2022 Free Software Foundation, Inc.
+Copyright 2009-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cache.c b/Build/source/libs/mpfr/mpfr-src/src/cache.c
index f9ff404c965..ae7c3429237 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cache.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cache.c
@@ -1,6 +1,6 @@
/* mpfr_cache -- cache interface for multiple-precision constants in MPFR.
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cbrt.c b/Build/source/libs/mpfr/mpfr-src/src/cbrt.c
index ab4c4dbbf62..11c8e8f48bd 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cbrt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cbrt.c
@@ -1,6 +1,6 @@
/* mpfr_cbrt -- cube root function.
-Copyright 2002-2022 Free Software Foundation, Inc.
+Copyright 2002-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/check.c b/Build/source/libs/mpfr/mpfr-src/src/check.c
index 0bc548fc51d..505caaf377d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/check.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/check.c
@@ -1,6 +1,6 @@
/* mpfr_check -- Check if a floating-point number has not been corrupted.
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/clear.c b/Build/source/libs/mpfr/mpfr-src/src/clear.c
index e486fa29491..f93faa2113d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/clear.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/clear.c
@@ -1,6 +1,6 @@
/* mpfr_clear -- free the memory space allocated for a floating-point number
-Copyright 1999-2001, 2004-2022 Free Software Foundation, Inc.
+Copyright 1999-2001, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/clears.c b/Build/source/libs/mpfr/mpfr-src/src/clears.c
index c33ecd8a5cb..72e687e7b4a 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/clears.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/clears.c
@@ -1,7 +1,7 @@
/* mpfr_clears -- free the memory space allocated for several
floating-point numbers
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp.c b/Build/source/libs/mpfr/mpfr-src/src/cmp.c
index 46fc0f5ffa2..d114d7f96b3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cmp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cmp.c
@@ -1,6 +1,6 @@
/* mpfr_cmp -- compare two floating-point numbers
-Copyright 1999, 2001, 2003-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001, 2003-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp2.c b/Build/source/libs/mpfr/mpfr-src/src/cmp2.c
index 30e20efa8e1..22a79e63bd4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cmp2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cmp2.c
@@ -1,6 +1,6 @@
/* mpfr_cmp2 -- exponent shift when subtracting two numbers.
-Copyright 1999-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_d.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_d.c
index 7437fac5e91..5214e233ef4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cmp_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_d.c
@@ -1,6 +1,6 @@
/* mpfr_cmp_d -- compare a floating-point number with a double
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c
index 6ca64d9ff8e..b67fbae5547 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_ld.c
@@ -1,6 +1,6 @@
/* mpfr_cmp_d -- compare a floating-point number with a long double
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_si.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_si.c
index b5f2d28cd4a..0bed7a9b429 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cmp_si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_si.c
@@ -1,7 +1,7 @@
/* mpfr_cmp_si_2exp -- compare a floating-point number with a signed
machine integer multiplied by a power of 2
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c b/Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c
index e5a74175860..df633f10ae4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cmp_ui.c
@@ -1,7 +1,7 @@
/* mpfr_cmp_ui_2exp -- compare a floating-point number with an unsigned
machine integer multiplied by a power of 2
-Copyright 1999, 2001-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmpabs.c b/Build/source/libs/mpfr/mpfr-src/src/cmpabs.c
index 291cf9d493e..34dc1defe04 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cmpabs.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cmpabs.c
@@ -1,6 +1,6 @@
/* mpfr_cmpabs -- compare the absolute values of two FP numbers
-Copyright 1999, 2001-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cmpabs_ui.c b/Build/source/libs/mpfr/mpfr-src/src/cmpabs_ui.c
index 7baf667a2dc..72ad6280881 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cmpabs_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cmpabs_ui.c
@@ -1,6 +1,6 @@
/* mpfr_cmpabs_ui -- compare the absolute value of FP to an unsigned long
-Copyright 2020-2022 Free Software Foundation, Inc.
+Copyright 2020-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/comparisons.c b/Build/source/libs/mpfr/mpfr-src/src/comparisons.c
index 549d1ea1a6b..e6015f210c6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/comparisons.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/comparisons.c
@@ -1,6 +1,6 @@
/* comparison predicates
-Copyright 2002-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2002-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/compound.c b/Build/source/libs/mpfr/mpfr-src/src/compound.c
new file mode 100644
index 00000000000..16f3b88d2f3
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/compound.c
@@ -0,0 +1,224 @@
+/* mpfr_compound_si --- compound(x,n) = (1+x)^n
+
+Copyright 2021-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H /* needed for MPFR_INT_CEIL_LOG2 */
+#include "mpfr-impl.h"
+
+/* assuming |(1+x)^n - 1| < 1/4*ulp(1), return correct rounding,
+ where s is the sign of n*log2(1+x) */
+static int
+mpfr_compound_near_one (mpfr_ptr y, int s, mpfr_rnd_t rnd_mode)
+{
+ mpfr_set_ui (y, 1, rnd_mode); /* exact */
+ if (rnd_mode == MPFR_RNDN || rnd_mode == MPFR_RNDF
+ || (s > 0 && (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDD))
+ || (s < 0 && (rnd_mode == MPFR_RNDA || rnd_mode == MPFR_RNDU)))
+ {
+ /* round toward 1 */
+ return -s;
+ }
+ else if (s > 0) /* necessarily RNDA or RNDU */
+ {
+ /* round toward +Inf */
+ mpfr_nextabove (y);
+ return +1;
+ }
+ else /* necessarily s < 0 and RNDZ or RNDD */
+ {
+ /* round toward 0 */
+ mpfr_nextbelow (y);
+ return -1;
+ }
+}
+
+/* put in y the correctly rounded value of (1+x)^n */
+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_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*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));
+
+ /* Special cases */
+ if (MPFR_IS_SINGULAR (x))
+ {
+ if (MPFR_IS_INF (x) && MPFR_IS_NEG (x))
+ {
+ /* compound(-Inf,n) is NaN */
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (n == 0 || MPFR_IS_ZERO (x))
+ {
+ /* compound(x,0) = 1 for x >= -1 or NaN (the only special value
+ of x that is not concerned is -Inf, already handled);
+ compound(0,n) = 1 */
+ return mpfr_set_ui (y, 1, rnd_mode);
+ }
+ else if (MPFR_IS_NAN (x))
+ {
+ /* compound(NaN,n) is NaN, except for n = 0, already handled. */
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else if (MPFR_IS_INF (x)) /* x = +Inf */
+ {
+ MPFR_ASSERTD (MPFR_IS_POS (x));
+ if (n < 0) /* (1+Inf)^n = +0 for n < 0 */
+ MPFR_SET_ZERO (y);
+ else /* n > 0: (1+Inf)^n = +Inf */
+ MPFR_SET_INF (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0); /* exact 0 or infinity */
+ }
+ }
+
+ /* (1+x)^n = NaN for x < -1 */
+ compared = mpfr_cmp_si (x, -1);
+ if (compared < 0)
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ /* compound(x,0) gives 1 for x >= 1 */
+ if (n == 0)
+ return mpfr_set_ui (y, 1, rnd_mode);
+
+ if (compared == 0)
+ {
+ if (n < 0)
+ {
+ /* compound(-1,n) = +Inf with divide-by-zero exception */
+ MPFR_SET_INF (y);
+ MPFR_SET_POS (y);
+ MPFR_SET_DIVBY0 ();
+ MPFR_RET (0);
+ }
+ else
+ {
+ /* compound(-1,n) = +0 */
+ MPFR_SET_ZERO (y);
+ MPFR_SET_POS (y);
+ MPFR_RET (0);
+ }
+ }
+
+ if (n == 1)
+ return mpfr_add_ui (y, x, 1, rnd_mode);
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ prec = MPFR_PREC(y);
+ prec += MPFR_INT_CEIL_LOG2 (prec) + 6;
+
+ mpfr_init2 (t, prec);
+
+ k = MPFR_INT_CEIL_LOG2(SAFE_ABS (unsigned long, n)); /* thus |n| <= 2^k */
+
+ 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)
+ {
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ 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)
+ {
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y,
+ (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))
+ {
+ /* since ulp(1) = 2^(1-PREC(y)), we have |t| < 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);
+ 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;
+ /* 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)))
+ break;
+
+ /* 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
+ fail (even for RNDN, as the ternary value cannot be determined),
+ yielding an infinite loop.
+ For an exact case in precision prec(y), 1+x will necessarily
+ be exact in precision prec(y), thus also in prec(t), where
+ prec(t) >= prec(y), and we can use mpfr_pow_si under this
+ condition (which will also evaluate some non-exact cases). */
+ if (mpfr_add_ui (t, x, 1, MPFR_RNDZ) == 0)
+ {
+ inexact = mpfr_pow_si (y, t, n, rnd_mode);
+ goto end;
+ }
+
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (t, prec);
+ }
+
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ end:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+
+ 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 d39a7d95ad6..2c748c933c8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/const_catalan.c
@@ -1,6 +1,6 @@
/* mpfr_const_catalan -- compute Catalan's constant.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/const_euler.c b/Build/source/libs/mpfr/mpfr-src/src/const_euler.c
index ffe722b90ac..fa127259536 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/const_euler.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/const_euler.c
@@ -1,6 +1,6 @@
/* mpfr_const_euler -- Euler's constant
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by Fredrik Johansson.
This file is part of the GNU MPFR Library.
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 81c17538b81..7e29e40faff 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/const_log2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/const_log2.c
@@ -1,6 +1,6 @@
/* mpfr_const_log2 -- compute natural logarithm of 2
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 0637c51852b..e72e2e11e42 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/const_pi.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/const_pi.c
@@ -1,6 +1,6 @@
/* mpfr_const_pi -- compute Pi
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/constant.c b/Build/source/libs/mpfr/mpfr-src/src/constant.c
index 6c06b8788b1..ca7a176a20d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/constant.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/constant.c
@@ -1,6 +1,6 @@
/* MPFR internal constant FP numbers
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/copysign.c b/Build/source/libs/mpfr/mpfr-src/src/copysign.c
index f1cbad8fa17..f6b9f228ca7 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/copysign.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/copysign.c
@@ -1,6 +1,6 @@
/* mpfr_copysign -- Produce a value with the magnitude of x and sign bit of y
-Copyright 2001-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2001-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -34,5 +34,14 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
int
mpfr_copysign (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
{
- return mpfr_set4 (z, x, rnd_mode, MPFR_SIGN (y));
+ if (MPFR_UNLIKELY (z != x))
+ return mpfr_set4 (z, x, rnd_mode, MPFR_SIGN (y));
+ else
+ {
+ MPFR_SET_SAME_SIGN (z, y);
+ if (MPFR_UNLIKELY (MPFR_IS_NAN (x)))
+ MPFR_RET_NAN;
+ else
+ MPFR_RET (0);
+ }
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cos.c b/Build/source/libs/mpfr/mpfr-src/src/cos.c
index 9841163e696..b6403687330 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cos.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cos.c
@@ -1,6 +1,6 @@
/* mpfr_cos -- cosine of a floating-point number
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -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[%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,
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 a471cf10327..9341b170ba7 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cosh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cosh.c
@@ -1,6 +1,6 @@
/* mpfr_cosh -- hyperbolic cosine
-Copyright 2001-2002, 2004-2022 Free Software Foundation, Inc.
+Copyright 2001-2002, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -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[%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,
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
new file mode 100644
index 00000000000..97ecfaa7570
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/cosu.c
@@ -0,0 +1,254 @@
+/* mpfr_cosu -- cosu(x) = cos(2*pi*x/u)
+ mpfr_cospi -- cospi(x) = cos(pi*x)
+
+Copyright 2020-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* put in y the correctly rounded value of cos(2*pi*x/u) */
+int
+mpfr_cosu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_srcptr xp;
+ mpfr_prec_t precy, prec;
+ mpfr_exp_t expx, expt, err, log2u, erra, errb;
+ mpfr_t t, xr;
+ int inexact = 0, nloops = 0, underflow = 0;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*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,
+ inexact));
+
+ if (u == 0 || MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ /* for u=0, return NaN */
+ if (u == 0 || MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else /* x is zero: cos(0) = 1 */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ return mpfr_set_ui (y, 1, rnd_mode);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Range reduction. We do not need to reduce the argument if it is
+ already reduced (|x| < u).
+ Note that the case |x| = u is better in the "else" branch as it
+ will give xr = 0. */
+ if (mpfr_cmpabs_ui (x, u) < 0)
+ {
+ xp = x;
+ }
+ else
+ {
+ mpfr_exp_t p = MPFR_GET_PREC (x) - MPFR_GET_EXP (x);
+ int inex;
+
+ /* Let's compute xr = x mod u, with signbit(xr) = signbit(x), though
+ this doesn't matter.
+ The precision of xr is chosen to ensure that x mod u is exactly
+ representable in xr, e.g., the maximum size of u + the length of
+ the fractional part of x. Note that since |x| >= u in this branch,
+ the additional memory amount will not be more than the one of x.
+ */
+ mpfr_init2 (xr, sizeof (unsigned long) * CHAR_BIT + (p < 0 ? 0 : p));
+ MPFR_DBGRES (inex = mpfr_fmod_ui (xr, x, u, MPFR_RNDN)); /* exact */
+ MPFR_ASSERTD (inex == 0);
+ if (MPFR_IS_ZERO (xr))
+ {
+ mpfr_clear (xr);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_set_ui (y, 1, rnd_mode);
+ }
+ xp = xr;
+ }
+
+#define CLEAR_XR \
+ do \
+ if (xp != x) \
+ { \
+ MPFR_ASSERTD (xp == xr); \
+ mpfr_clear (xr); \
+ } \
+ while (0)
+
+ /* now |xp/u| < 1 */
+
+ /* for x small, we have |cos(2*pi*x/u)-1| < 1/2*(2*pi*x/u)^2 < 2^5*(x/u)^2 */
+ expx = MPFR_GET_EXP (xp);
+ log2u = u == 1 ? 0 : MPFR_INT_CEIL_LOG2 (u) - 1;
+ /* u >= 2^log2u thus 1/u <= 2^(-log2u) */
+ erra = -2 * expx;
+ errb = 5 - 2 * log2u;
+ /* The 3rd argument (err1) of MPFR_SMALL_INPUT_AFTER_SAVE_EXPO should be
+ erra - errb, but it may overflow. The negative overflow is avoided by
+ the test erra > errb: if erra - errb <= 0, the macro is no-op.
+ Saturate to MPFR_EXP_MAX in case of positive overflow, as the error
+ test in MPFR_SMALL_INPUT_AFTER_SAVE_EXPO will always be true for
+ any value >= MPFR_PREC_MAX + 1, and this includes MPFR_EXP_MAX (from
+ the definition of MPFR_PREC_MAX and mpfr_exp_t >= mpfr_prec_t). */
+ if (erra > errb)
+ {
+ mpfr_exp_t err1 = errb >= 0 || erra < MPFR_EXP_MAX + errb ?
+ erra - errb : MPFR_EXP_MAX;
+ MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_one, err1, 0, 0,
+ rnd_mode, expo, CLEAR_XR);
+ }
+
+ precy = MPFR_GET_PREC (y);
+ /* For x large, since argument reduction is expensive, we want to avoid
+ any failure in Ziv's strategy, thus we take into account expx too. */
+ prec = precy + MAX(expx,MPFR_INT_CEIL_LOG2 (precy)) + 8;
+ MPFR_ASSERTD(prec >= 2);
+ mpfr_init2 (t, prec);
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ nloops ++;
+ /* In the error analysis below, xp stands for x.
+ We first compute an approximation t of 2*pi*x/u, then call cos(t).
+ If t = 2*pi*x/u + s, then |cos(t) - cos(2*pi*x/u)| <= |s|. */
+ mpfr_set_prec (t, prec);
+ mpfr_const_pi (t, MPFR_RNDN); /* t = pi * (1 + theta1) where
+ |theta1| <= 2^-prec */
+ mpfr_mul_2ui (t, t, 1, MPFR_RNDN); /* t = 2*pi * (1 + theta1) */
+ mpfr_mul (t, t, xp, MPFR_RNDN); /* t = 2*pi*x * (1 + theta2)^2 where
+ |theta2| <= 2^-prec */
+ mpfr_div_ui (t, t, u, MPFR_RNDN); /* t = 2*pi*x/u * (1 + theta3)^3 where
+ |theta3| <= 2^-prec */
+ /* if t is zero here, it means the division by u underflowd */
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (t)))
+ {
+ mpfr_set_ui (y, 1, MPFR_RNDZ);
+ if (MPFR_IS_LIKE_RNDZ(rnd_mode,0))
+ {
+ inexact = -1;
+ mpfr_nextbelow (y);
+ }
+ else
+ inexact = 1;
+ goto end;
+ }
+ /* since prec >= 2, |(1 + theta3)^3 - 1| <= 4*theta3 <= 2^(2-prec) */
+ expt = MPFR_GET_EXP (t);
+ /* we have |s| <= 2^(expt + 2 - prec) */
+ mpfr_cos (t, t, MPFR_RNDN);
+ err = expt + 2 - prec;
+ expt = MPFR_GET_EXP (t); /* new exponent of t */
+ /* the total error is at most 2^err + ulp(t)/2 = 2^err + 2^(expt-prec-1)
+ thus if err <= expt-prec-1, it is bounded by 2^(expt-prec),
+ otherwise it is bounded by 2^(err+1). */
+ err = (err <= expt - prec - 1) ? expt - prec : err + 1;
+ /* normalize err for mpfr_can_round */
+ err = expt - err;
+ if (MPFR_CAN_ROUND (t, err, precy, rnd_mode))
+ break;
+ /* Check exact cases only after the first level of Ziv' strategy, to
+ avoid slowing down the average case. Exact cases are:
+ (a) 2*pi*x/u is a multiple of pi/2, i.e., x/u is a multiple of 1/4
+ (b) 2*pi*x/u is {pi/3,2pi/3,4pi/3,5pi/3} mod 2pi */
+ if (nloops == 1)
+ {
+ /* detect case (a) */
+ inexact = mpfr_div_ui (t, xp, u, MPFR_RNDZ);
+ mpfr_mul_2ui (t, t, 2, MPFR_RNDZ);
+ if (inexact == 0 && mpfr_integer_p (t))
+ {
+ if (mpfr_odd_p (t))
+ /* t is odd: we have kpi+pi/2, thus cosu = 0,
+ for the sign, we always return +0, following IEEE 754-2019:
+ cosPi(n + 1/2) is +0 for any integer n when n + 1/2 is
+ representable. */
+ mpfr_set_zero (y, +1);
+ else /* t is even: case kpi */
+ {
+ mpfr_div_2ui (t, t, 1, MPFR_RNDZ);
+ if (!mpfr_odd_p (t))
+ /* case 2kpi: cosu = 1 */
+ mpfr_set_ui (y, 1, MPFR_RNDZ);
+ else
+ mpfr_set_si (y, -1, MPFR_RNDZ);
+ }
+ goto end;
+ }
+ /* detect case (b): this can only occur if u is divisible by 3 */
+ if ((u % 3) == 0)
+ {
+ inexact = mpfr_div_ui (t, xp, u / 3, MPFR_RNDZ);
+ /* t should be in {1/2,2/2,4/2,5/2} */
+ mpfr_mul_2ui (t, t, 1, MPFR_RNDZ);
+ /* t should be {1,2,4,5} mod 6:
+ t = 1 mod 6: case pi/3: return 1/2
+ t = 2 mod 6: case 2pi/3: return -1/2
+ t = 4 mod 6: case 4pi/3: return -1/2
+ t = 5 mod 6: case 5pi/3: return 1/2 */
+ if (inexact == 0 && mpfr_integer_p (t))
+ {
+ mpz_t z;
+ unsigned long mod6;
+ mpz_init (z);
+ inexact = mpfr_get_z (z, t, MPFR_RNDZ);
+ MPFR_ASSERTN(inexact == 0);
+ mod6 = mpz_fdiv_ui (z, 6);
+ mpz_clear (z);
+ if (mod6 == 1 || mod6 == 5)
+ {
+ mpfr_set_ui_2exp (y, 1, -1, MPFR_RNDZ);
+ goto end;
+ }
+ else /* we cannot have mod6 = 0 or 3 since those
+ case belong to (a) */
+ {
+ MPFR_ASSERTD(mod6 == 2 || mod6 == 4);
+ mpfr_set_si_2exp (y, -1, -1, MPFR_RNDZ);
+ goto end;
+ }
+ }
+ }
+ }
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ end:
+ mpfr_clear (t);
+ CLEAR_XR;
+ MPFR_SAVE_EXPO_FREE (expo);
+ return underflow ? inexact : mpfr_check_range (y, inexact, rnd_mode);
+}
+
+int
+mpfr_cospi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_cosu (y, x, 2, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/cot.c b/Build/source/libs/mpfr/mpfr-src/src/cot.c
index c3c82383db4..4e46f4a8ee8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/cot.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/cot.c
@@ -1,6 +1,6 @@
/* mpfr_cot - cotangent function.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/coth.c b/Build/source/libs/mpfr/mpfr-src/src/coth.c
index 20f6f31595a..7ca5b23aabb 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/coth.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/coth.c
@@ -1,6 +1,6 @@
/* mpfr_coth - Hyperbolic cotangent function.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/csc.c b/Build/source/libs/mpfr/mpfr-src/src/csc.c
index 24d20197fb1..05f5de3eb07 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/csc.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/csc.c
@@ -1,6 +1,6 @@
/* mpfr_csc - cosecant function.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/csch.c b/Build/source/libs/mpfr/mpfr-src/src/csch.c
index 935ce35cfc7..7c1d089fdcf 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/csch.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/csch.c
@@ -1,6 +1,6 @@
/* mpfr_csch - Hyperbolic cosecant function.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 f6513427e86..9a0600ccb39 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/d_div.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/d_div.c
@@ -1,7 +1,7 @@
/* mpfr_d_div -- divide a machine double precision float
by a multiple precision floating-point number
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -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[%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));
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 d80396495b5..4496ab907cd 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/d_sub.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/d_sub.c
@@ -1,7 +1,7 @@
/* mpfr_d_sub -- subtract a multiple precision floating-point number
from a machine double precision float
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -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[%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));
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 b5f3ac60a9e..6cb7ec8d864 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/digamma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/digamma.c
@@ -1,6 +1,6 @@
/* mpfr_digamma -- digamma function of a floating-point number
-Copyright 2009-2022 Free Software Foundation, Inc.
+Copyright 2009-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/dim.c b/Build/source/libs/mpfr/mpfr-src/src/dim.c
index 72bef41f49b..23c5c45b7de 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/dim.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/dim.c
@@ -1,6 +1,6 @@
/* mpfr_dim -- positive difference
-Copyright 2001-2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2001-2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/div.c b/Build/source/libs/mpfr/mpfr-src/src/div.c
index 6dc8bdbeeca..28426c483e9 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div.c
@@ -1,6 +1,6 @@
/* mpfr_div -- divide two floating-point numbers
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/div_2exp.c b/Build/source/libs/mpfr/mpfr-src/src/div_2exp.c
index 0bae0fbae5d..2a3c45e17e9 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_2exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_2exp.c
@@ -1,6 +1,6 @@
/* mpfr_div_2exp -- divide a floating-point number by a power of two
-Copyright 1999, 2001, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 14abfdfb483..ae584a409a5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_2si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_2si.c
@@ -1,6 +1,6 @@
/* mpfr_div_2si -- divide a floating-point number by a power of two
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 79af3f84ce5..7dac999b09f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_2ui.c
@@ -1,6 +1,6 @@
/* mpfr_div_2ui -- divide a floating-point number by a power of two
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 7182a90dc84..f5fdf9b6789 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_d.c
@@ -1,7 +1,7 @@
/* mpfr_div_d -- divide a multiple precision floating-point number
by a machine double precision float
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 2d16e367631..4e051ea1fc6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/div_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/div_ui.c
@@ -1,6 +1,6 @@
/* mpfr_div_ui -- divide a floating-point number by a machine integer
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/dot.c b/Build/source/libs/mpfr/mpfr-src/src/dot.c
index 582af6ed3aa..934b54720ab 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/dot.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/dot.c
@@ -1,6 +1,6 @@
/* mpfr_dot -- dot product of two array of numbers
-Copyright 2018-2022 Free Software Foundation, Inc.
+Copyright 2018-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/dump.c b/Build/source/libs/mpfr/mpfr-src/src/dump.c
index 3cfaa829758..644c30ae71f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/dump.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/dump.c
@@ -1,6 +1,6 @@
/* mpfr_dump, mpfr_fdump -- dump a float (for the tests and debugging purpose)
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/eint.c b/Build/source/libs/mpfr/mpfr-src/src/eint.c
index d1190a5ae30..f9eb54f29e7 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/eint.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/eint.c
@@ -1,6 +1,6 @@
/* mpfr_eint, mpfr_eint1 -- the exponential integral
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/eq.c b/Build/source/libs/mpfr/mpfr-src/src/eq.c
index 02662c5cd3b..9d2985cd782 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/eq.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/eq.c
@@ -1,6 +1,6 @@
/* mpfr_eq -- Compare two floats up to a specified bit #.
-Copyright 1999, 2001, 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001, 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/erandom.c b/Build/source/libs/mpfr/mpfr-src/src/erandom.c
index 971f3c5d5dc..d910ec5bd52 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/erandom.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/erandom.c
@@ -2,7 +2,7 @@
mean 1 and round it to the precision of rop according to the given rounding
mode.
-Copyright 2013-2022 Free Software Foundation, Inc.
+Copyright 2013-2023 Free Software Foundation, Inc.
Contributed by Charles Karney <charles@karney.com>, SRI International.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/erf.c b/Build/source/libs/mpfr/mpfr-src/src/erf.c
index 16710b4aef9..b0d820ed5af 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/erf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/erf.c
@@ -1,6 +1,6 @@
/* mpfr_erf -- error function of a floating-point number
-Copyright 2001, 2003-2022 Free Software Foundation, Inc.
+Copyright 2001, 2003-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -97,7 +97,7 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
inex = mpfr_prec_round (l, MPFR_PREC(y), rnd_mode);
inex2 = mpfr_prec_round (h, MPFR_PREC(y), rnd_mode);
/* Caution: we also need inex=inex2 (inex might be 0). */
- ok = SAME_SIGN (inex, inex2) && mpfr_cmp (l, h) == 0;
+ ok = SAME_SIGN (inex, inex2) && mpfr_equal_p (l, h);
if (ok)
mpfr_set (y, h, rnd_mode);
mpfr_clear (l);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/erfc.c b/Build/source/libs/mpfr/mpfr-src/src/erfc.c
index a1d9f42e580..b2db6a9e12a 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/erfc.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/erfc.c
@@ -1,6 +1,6 @@
/* mpfr_erfc -- The Complementary Error Function of a floating-point number
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exceptions.c b/Build/source/libs/mpfr/mpfr-src/src/exceptions.c
index 3a1bcbec446..800d9936a08 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exceptions.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exceptions.c
@@ -1,6 +1,6 @@
/* Exception flags and utilities. Constructors and destructors (debug).
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -252,6 +252,9 @@ mpfr_set_erangeflag (void)
/* Note: It is possible that for pure FP numbers, EXP(x) < MPFR_EMIN_MIN,
but the caller must make sure that the difference remains small enough
to avoid reaching the special exponent values. */
+/* This function does not have logging messages. As it is also partly
+ implemented as a macro, if messages are added in the future, the macro
+ may need to be disabled when logging is enabled. */
int
mpfr_check_range (mpfr_ptr x, int t, mpfr_rnd_t rnd_mode)
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp.c b/Build/source/libs/mpfr/mpfr-src/src/exp.c
index 35594a44940..de57dcddd72 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp.c
@@ -1,6 +1,6 @@
/* mpfr_exp -- exponential of a floating-point number
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp10.c b/Build/source/libs/mpfr/mpfr-src/src/exp10.c
index 59969bda2e4..9f988496783 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp10.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp10.c
@@ -1,6 +1,6 @@
/* mpfr_exp10 -- power of 10 function 10^y
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp10m1.c b/Build/source/libs/mpfr/mpfr-src/src/exp10m1.c
new file mode 100644
index 00000000000..42eb215b3aa
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp10m1.c
@@ -0,0 +1,179 @@
+/* mpfr_exp10m1 -- Compute 10^x-1
+
+Copyright 2001-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of exp10m1 is done by expm1(x) = 10^x-1 */
+
+/* In case x is small in absolute value, 10^x - 1 ~ x*log(10).
+ If this is enough to deduce correct rounding, put in the auxiliary variable
+ t the approximation that will be rounded to get y, and return non-zero.
+ If we put 0 in t, it means underflow.
+ Otherwise return 0. */
+static int
+mpfr_exp10m1_small (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode,
+ mpfr_ptr t)
+{
+ mpfr_prec_t prec;
+ mpfr_exp_t e;
+
+ /* for |x| < 0.25, we have |10^x-1-x*log(10)| < 4*x^2 */
+ if (MPFR_EXP(x) > -2)
+ return 0;
+ /* now EXP(x) <= -2, thus x < 0.25 */
+ prec = MPFR_PREC(t);
+ mpfr_log_ui (t, 10, MPFR_RNDN);
+ /* t = log(10)*(1 + theta) with |theta| <= 2^(-prec) */
+ mpfr_mul (t, t, x, MPFR_RNDN);
+ /* no underflow can occur, since log(10) > 1 */
+ /* t = x*log(10)*(1 + theta)^2 with |theta| <= 2^(-prec) */
+ /* |t - x*log(10)| <= ((1 + theta)^2 - 1) * |t| <= 3*2^(-prec)*|t| */
+ /* |t - x*log(10)| < 3*2^(EXP(t)-prec) */
+ e = 2 * MPFR_GET_EXP (x) + 2 + prec - MPFR_GET_EXP(t);
+ /* |4*x^2| < 2^e*2^(EXP(t)-prec) thus
+ |t - exp10m1(x)| < (3+2^e)*2^(EXP(t)-prec) */
+ e = (e <= 1) ? 2 + (e == 1) : e + 1;
+ /* now |t - exp10m1(x)| < 2^e*2^(EXP(t)-prec) */
+ return MPFR_CAN_ROUND (t, prec - e, MPFR_PREC(y), rnd_mode);
+}
+
+int
+mpfr_exp10m1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inexact, nloop;
+ mpfr_t t;
+ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ mpfr_exp_t err, exp_te; /* error */
+ MPFR_ZIV_DECL (loop);
+ 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,
+ inexact));
+
+ if (MPFR_IS_SINGULAR (x))
+ return mpfr_expm1 (y, x, rnd_mode); /* singular cases are identical */
+
+ MPFR_ASSERTN(!MPFR_IS_ZERO(x));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Check case where result is -1 or nextabove(-1) because x is a huge
+ negative number. */
+ if (MPFR_IS_NEG(x) && mpfr_cmpabs_ui (x, 2 + (MPFR_PREC(y) - 1) / 3) > 0)
+ {
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_INEXACT);
+ /* 1/2*ulp(-1) = 2^(-PREC(y)):
+ since |x| >= PREC(y)/3 + 1, then 3*|x| >= PREC(y) + 3,
+ thus 10^x < 8^x <= 2^(-PREC(y)-3) <= 1/2*ulp(-1), thus the
+ result is -1 for RNDA,RNDD,RNDN, and nextabove(-1) for RNDZ,RNDU */
+ mpfr_set_si (y, -1, MPFR_RNDZ);
+ if (!MPFR_IS_LIKE_RNDZ(rnd_mode,1))
+ inexact = -1;
+ else
+ {
+ mpfr_nextabove (y);
+ inexact = 1;
+ }
+ goto end;
+ }
+
+ Nt = Ny + MPFR_INT_CEIL_LOG2 (Ny) + 6;
+
+ mpfr_init2 (t, Nt);
+
+ MPFR_ZIV_INIT (loop, Nt);
+ for (nloop = 0;; nloop++)
+ {
+ int inex1;
+
+ MPFR_BLOCK_DECL (flags);
+
+ /* 10^x may overflow and underflow */
+ MPFR_BLOCK (flags, inex1 = mpfr_exp10 (t, x, MPFR_RNDN));
+
+ if (MPFR_OVERFLOW (flags)) /* overflow case */
+ {
+ inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN_POS);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ goto clear;
+ }
+
+ /* integer case */
+ if (inex1 == 0)
+ {
+ inexact = mpfr_sub_ui (y, t, 1, rnd_mode);
+ goto clear;
+ }
+
+ /* The case of underflow in 10^x (huge negative x)
+ was already detected before Ziv's loop. */
+ MPFR_ASSERTD(!MPFR_UNDERFLOW (flags));
+
+ MPFR_ASSERTN(!MPFR_IS_ZERO(t));
+ exp_te = MPFR_GET_EXP (t);
+ mpfr_sub_ui (t, t, 1, MPFR_RNDN); /* 10^x-1 */
+
+ /* error estimate */
+ /* err = __gmpfr_ceil_log2(1+pow(2,MPFR_EXP(te)-MPFR_EXP(t))) */
+ if (!MPFR_IS_ZERO(t))
+ {
+ err = MAX (exp_te - MPFR_GET_EXP (t), 0) + 1;
+ /* if inex1=0, this means that t=o(10^x) is exact, thus the correct
+ rounding is simply o(t-1) */
+ if (inex1 == 0 ||
+ MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - err, Ny, rnd_mode)))
+ break;
+ }
+
+ /* check small case: we need to do it at each step of Ziv's loop,
+ since the multiplication x*log(10) might not enable correct
+ rounding at the first loop */
+ if (mpfr_exp10m1_small (y, x, rnd_mode, t))
+ {
+ if (MPFR_IS_ZERO(t)) /* underflow */
+ {
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y, (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ
+ : rnd_mode, 1);
+ }
+ break;
+ }
+
+ /* increase the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+
+ inexact = mpfr_set (y, t, rnd_mode);
+ clear:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp2.c b/Build/source/libs/mpfr/mpfr-src/src/exp2.c
index bbcf45b6e38..b64546bb339 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp2.c
@@ -1,6 +1,6 @@
/* mpfr_exp2 -- power of 2 function 2^y
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -23,14 +23,31 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
+/* TODO: mpfr_get_exp_t is called 3 times, with 3 different directed
+ rounding modes. One could reduce it to only one call thanks to the
+ inexact flag, but is it worth? */
+
+/* Convert x to an mpfr_eexp_t integer, with saturation at the minimum
+ and maximum values. Flags are unchanged. */
+static mpfr_eexp_t
+round_to_eexp_t (mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_flags_t flags = __gmpfr_flags;
+ mpfr_eexp_t e;
+
+ e = mpfr_get_exp_t (x, rnd_mode);
+ __gmpfr_flags = flags;
+ return e;
+}
+
/* The computation of y = 2^z is done by *
* y = exp(z*log(2)). The result is exact iff z is an integer. */
int
mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
{
- int inexact, inex2;
- long xint;
+ int inexact;
+ mpfr_eexp_t xint; /* note: will fit in mpfr_exp_t */
mpfr_t xfrac;
MPFR_SAVE_EXPO_DECL (expo);
@@ -68,12 +85,10 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
might round to 2^(emin - 1) for rounding away or to nearest, and there
might be no underflow, since we consider underflow "after rounding". */
- MPFR_STAT_STATIC_ASSERT (MPFR_EMIN_MIN >= LONG_MIN + 2);
- if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emin - 2) <= 0))
+ if (MPFR_UNLIKELY (round_to_eexp_t (x, MPFR_RNDU) <= __gmpfr_emin - 2))
return mpfr_underflow (y, rnd_mode == MPFR_RNDN ? MPFR_RNDZ : rnd_mode, 1);
- MPFR_STAT_STATIC_ASSERT (MPFR_EMAX_MAX <= LONG_MAX);
- if (MPFR_UNLIKELY (mpfr_cmp_si (x, __gmpfr_emax) >= 0))
+ if (MPFR_UNLIKELY (round_to_eexp_t (x, MPFR_RNDD) >= __gmpfr_emax))
return mpfr_overflow (y, rnd_mode, 1);
/* We now know that emin - 2 < x < emax. Note that an underflow or
@@ -87,9 +102,11 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_one, - MPFR_GET_EXP (x), 0,
MPFR_IS_POS (x), rnd_mode, expo, {});
- xint = mpfr_get_si (x, MPFR_RNDZ);
+ xint = mpfr_get_exp_t (x, MPFR_RNDZ);
+ MPFR_ASSERTD (__gmpfr_emin - 2 < xint && xint < __gmpfr_emax);
+
mpfr_init2 (xfrac, MPFR_PREC (x));
- MPFR_DBGRES (inexact = mpfr_sub_si (xfrac, x, xint, MPFR_RNDN));
+ MPFR_DBGRES (inexact = mpfr_frac (xfrac, x, MPFR_RNDN));
MPFR_ASSERTD (inexact == 0);
if (MPFR_IS_ZERO (xfrac))
@@ -156,11 +173,10 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
}
else
{
- MPFR_CLEAR_FLAGS ();
- inex2 = mpfr_mul_2si (y, y, xint, rnd_mode);
- if (inex2 != 0) /* underflow or overflow */
- inexact = inex2;
- MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
+ /* The following is OK due to early overflow/underflow checking.
+ the exponent may be slightly out-of-range, but this will be
+ handled by mpfr_check_range. */
+ MPFR_EXP (y) += xint;
}
MPFR_SAVE_EXPO_FREE (expo);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp2m1.c b/Build/source/libs/mpfr/mpfr-src/src/exp2m1.c
new file mode 100644
index 00000000000..4dc4221bdb4
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp2m1.c
@@ -0,0 +1,185 @@
+/* mpfr_exp2m1 -- Compute 2^x-1
+
+Copyright 2001-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* The computation of exp2m1 is done by expm1(x) = 2^x-1 */
+
+/* In case x is small in absolute value, 2^x - 1 ~ x*log(2).
+ If this is enough to deduce correct rounding, put in the auxiliary variable
+ t the approximation that will be rounded to get y, and return non-zero.
+ If we put 0 in t, it means underflow.
+ Otherwise return 0. */
+static int
+mpfr_exp2m1_small (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode, mpfr_ptr t)
+{
+ mpfr_prec_t prec;
+ mpfr_exp_t e;
+ MPFR_BLOCK_DECL (flags);
+
+ /* for |x| < 0.125, we have |2^x-1-x*log(2)| < x^2/4 */
+ if (MPFR_EXP(x) > -3)
+ return 0;
+ /* now EXP(x) <= -3, thus x < 0.125 */
+ prec = MPFR_PREC(t);
+ mpfr_const_log2 (t, MPFR_RNDN);
+ /* t = log(2)*(1 + theta) with |theta| <= 2^(-prec) */
+ MPFR_BLOCK (flags, mpfr_mul (t, t, x, MPFR_RNDN));
+ /* If an underflow occurs in log(2)*x, then return underflow. */
+ if (MPFR_UNDERFLOW (flags))
+ {
+ MPFR_SET_ZERO (t);
+ return 1;
+ }
+ /* t = x*log(2)*(1 + theta)^2 with |theta| <= 2^(-prec) */
+ /* |t - x*log(2)| <= ((1 + theta)^2 - 1) * |t| <= 3*2^(-prec)*|t| */
+ /* |t - x*log(2)| < 3*2^(EXP(t)-prec) */
+ e = 2 * MPFR_GET_EXP (x) - 2 + prec - MPFR_GET_EXP(t);
+ /* |x^2/4| < 2^e*2^(EXP(t)-prec) thus
+ |t - exp2m1(x)| < (3+2^e)*2^(EXP(t)-prec) */
+ e = (e <= 1) ? 2 + (e == 1) : e + 1;
+ /* now |t - exp2m1(x)| < 2^e*2^(EXP(t)-prec) */
+ return MPFR_CAN_ROUND (t, prec - e, MPFR_PREC(y), rnd_mode);
+}
+
+int
+mpfr_exp2m1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int inexact, nloop;
+ mpfr_t t;
+ mpfr_prec_t Ny = MPFR_PREC(y); /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+ mpfr_exp_t err, exp_te; /* error */
+ MPFR_ZIV_DECL (loop);
+ 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,
+ inexact));
+
+ if (MPFR_IS_SINGULAR (x))
+ return mpfr_expm1 (y, x, rnd_mode); /* singular cases are identical */
+
+ MPFR_ASSERTN(!MPFR_IS_ZERO(x));
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Check case where result is -1 or nextabove(-1) because x is a huge
+ negative number. */
+ if (MPFR_IS_NEG(x) && mpfr_cmpabs_ui (x, MPFR_PREC(y) + 1) > 0)
+ {
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_INEXACT);
+ /* 1/2*ulp(-1) = 2^(-PREC(y)) thus 2^x < 1/4*ulp(-1):
+ result is -1 for RNDA,RNDD,RNDN, and nextabove(-1) for RNDZ,RNDU */
+ mpfr_set_si (y, -1, MPFR_RNDZ);
+ if (!MPFR_IS_LIKE_RNDZ(rnd_mode,1))
+ inexact = -1;
+ else
+ {
+ mpfr_nextabove (y);
+ inexact = 1;
+ }
+ goto end;
+ }
+
+ /* compute the precision of intermediary variable */
+ /* the optimal number of bits : see algorithms.tex */
+ Nt = Ny + MPFR_INT_CEIL_LOG2 (Ny) + 6;
+
+ mpfr_init2 (t, Nt);
+
+ MPFR_ZIV_INIT (loop, Nt);
+ for (nloop = 0;; nloop++)
+ {
+ int inex1;
+
+ MPFR_BLOCK_DECL (flags);
+
+ /* 2^x may overflow and underflow */
+ MPFR_BLOCK (flags, inex1 = mpfr_exp2 (t, x, MPFR_RNDN));
+
+ if (MPFR_OVERFLOW (flags)) /* overflow case */
+ {
+ inexact = mpfr_overflow (y, rnd_mode, MPFR_SIGN_POS);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_OVERFLOW);
+ goto clear;
+ }
+
+ /* integer case */
+ if (inex1 == 0)
+ {
+ inexact = mpfr_sub_ui (y, t, 1, rnd_mode);
+ goto clear;
+ }
+
+ /* To get an underflow in 2^x, we need 2^x < 0.5*2^MPFR_EMIN_MIN
+ thus x < MPFR_EMIN_MIN-1. But in that case (huge negative x)
+ was already detected before Ziv's loop. */
+ MPFR_ASSERTD(!MPFR_UNDERFLOW (flags));
+
+ MPFR_ASSERTN(!MPFR_IS_ZERO(t));
+ exp_te = MPFR_GET_EXP (t);
+ mpfr_sub_ui (t, t, 1, MPFR_RNDN); /* 2^x-1 */
+
+ /* error estimate */
+ /* err = __gmpfr_ceil_log2(1+pow(2,MPFR_EXP(te)-MPFR_EXP(t))) */
+ if (!MPFR_IS_ZERO(t))
+ {
+ err = MAX (exp_te - MPFR_GET_EXP (t), 0) + 1;
+ /* if inex1=0, this means that t=o(2^x) is exact, thus the correct
+ rounding is simply o(t-1) */
+ if (inex1 == 0 ||
+ MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - err, Ny, rnd_mode)))
+ break;
+ }
+
+ /* check small case: we need to do it at each step of Ziv's loop,
+ since the multiplication x*log(2) might not enable correct
+ rounding at the first loop */
+ if (mpfr_exp2m1_small (y, x, rnd_mode, t))
+ {
+ if (MPFR_IS_ZERO(t)) /* underflow */
+ {
+ mpfr_clear (t);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_underflow (y, (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ
+ : rnd_mode, 1);
+ }
+ break;
+ }
+
+ /* increase the precision */
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+
+ inexact = mpfr_set (y, t, rnd_mode);
+ clear:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+
+ end:
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp3.c b/Build/source/libs/mpfr/mpfr-src/src/exp3.c
index 39c58a81e47..890d7e900d6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp3.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp3.c
@@ -1,6 +1,6 @@
/* mpfr_exp -- exponential of a floating-point number
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 ced0ad12315..b59ad02bee4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/exp_2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/exp_2.c
@@ -1,7 +1,7 @@
/* mpfr_exp_2 -- exponential of a floating-point number
using algorithms in O(n^(1/2)*M(n)) and O(n^(1/3)*M(n))
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/expm1.c b/Build/source/libs/mpfr/mpfr-src/src/expm1.c
index f58a9ca93ae..a8b8d5a5358 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/expm1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/expm1.c
@@ -1,6 +1,6 @@
/* mpfr_expm1 -- Compute exp(x)-1
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/extract.c b/Build/source/libs/mpfr/mpfr-src/src/extract.c
index 52bbf6dbe7b..27ed29edcbf 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/extract.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/extract.c
@@ -1,6 +1,6 @@
/* mpfr_extract -- bit-extraction function for the binary splitting algorithm
-Copyright 2000-2002, 2004-2022 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/factorial.c b/Build/source/libs/mpfr/mpfr-src/src/factorial.c
index 21a0f164831..92f6089ffae 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/factorial.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/factorial.c
@@ -1,6 +1,6 @@
/* mpfr_fac_ui -- factorial of a non-negative integer
-Copyright 2001, 2004-2022 Free Software Foundation, Inc.
+Copyright 2001, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c b/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c
index b88e7da8d80..25c4b098d1c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c
@@ -1,6 +1,6 @@
/* mpfr_fits_intmax_p -- test whether an mpfr fits an intmax_t.
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -58,7 +58,7 @@ mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd)
if (neg)
{
uintmax_t s;
- /* In C89, the division on negative integers isn't well-defined. */
+ /* In C90, the division on negative integers isn't well-defined. */
s = SAFE_ABS (uintmax_t, INTMAX_MIN);
for (prec = 0; s != 0; s /= 2, prec ++);
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_s.h b/Build/source/libs/mpfr/mpfr-src/src/fits_s.h
index 8caeca8f46b..68a68a4a44d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_s.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_s.h
@@ -1,6 +1,6 @@
/* mpfr_fits_*_p -- test whether an mpfr fits a C signed type.
-Copyright 2003-2022 Free Software Foundation, Inc.
+Copyright 2003-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -58,7 +58,7 @@ FUNCTION (mpfr_srcptr f, mpfr_rnd_t rnd)
if (neg)
{
unsigned TYPE s;
- /* In C89, the division on negative integers isn't well-defined. */
+ /* In C90, the division on negative integers isn't well-defined. */
s = SAFE_ABS (unsigned TYPE, MINIMUM);
for (prec = 0; s != 0; s /= 2, prec ++);
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_sint.c b/Build/source/libs/mpfr/mpfr-src/src/fits_sint.c
index 8f5dd780951..dfa3200d650 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_sint.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_sint.c
@@ -1,6 +1,6 @@
/* mpfr_fits_sint_p -- test whether an mpfr fits an int.
-Copyright 2003, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_slong.c b/Build/source/libs/mpfr/mpfr-src/src/fits_slong.c
index 7d632bfcc53..662d4d9c4bf 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_slong.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_slong.c
@@ -1,6 +1,6 @@
/* mpfr_fits_slong_p -- test whether an mpfr fits a long.
-Copyright 2003, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c b/Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c
index ba8dfebac0b..91727758a66 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_sshort.c
@@ -1,6 +1,6 @@
/* mpfr_fits_sshort_p -- test whether an mpfr fits a short.
-Copyright 2003, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_u.h b/Build/source/libs/mpfr/mpfr-src/src/fits_u.h
index c7c2b3bb378..f6c277be5d3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_u.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_u.h
@@ -1,6 +1,6 @@
/* mpfr_fits_*_p -- test whether an mpfr fits a C unsigned type.
-Copyright 2003-2022 Free Software Foundation, Inc.
+Copyright 2003-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_uint.c b/Build/source/libs/mpfr/mpfr-src/src/fits_uint.c
index d57081b5bc0..b47ba2be0fa 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_uint.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_uint.c
@@ -1,6 +1,6 @@
/* mpfr_fits_uint_p -- test whether an mpfr fits an unsigned int.
-Copyright 2003, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c b/Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c
index d8d5259d4f9..b56aaae290f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_uintmax.c
@@ -1,6 +1,6 @@
/* mpfr_fits_uintmax_p -- test whether an mpfr fits an uintmax_t.
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c b/Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c
index 0c633c258bb..089883f226e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_ulong.c
@@ -1,6 +1,6 @@
/* mpfr_fits_ulong_p -- test whether an mpfr fits an unsigned long.
-Copyright 2003, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c b/Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c
index 2ba2aa60f9b..0684806ef74 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_ushort.c
@@ -1,6 +1,6 @@
/* mpfr_fits_ushort_p -- test whether an mpfr fits an unsigned short.
-Copyright 2003, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fma.c b/Build/source/libs/mpfr/mpfr-src/src/fma.c
index e186b72fa9f..5ea26addab2 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fma.c
@@ -1,6 +1,6 @@
/* mpfr_fma -- Floating multiply-add
-Copyright 2001-2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2001-2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -90,7 +90,8 @@ mpfr_fma_singular (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
else /* necessarily z is zero here */
{
MPFR_ASSERTD(MPFR_IS_ZERO(z));
- return mpfr_mul (s, x, y, rnd_mode);
+ return (x == y) ? mpfr_sqr (s, x, rnd_mode)
+ : mpfr_mul (s, x, y, rnd_mode);
}
}
@@ -191,7 +192,10 @@ mpfr_fma (mpfr_ptr s, mpfr_srcptr x, mpfr_srcptr y, mpfr_srcptr z,
MPFR_TMP_INIT (up, u, un * GMP_NUMB_BITS, un);
up = MPFR_MANT(u);
/* multiply x*y exactly into u */
- mpn_mul_n (up, MPFR_MANT(x), MPFR_MANT(y), n);
+ if (x == y)
+ mpn_sqr (up, MPFR_MANT(x), n);
+ else
+ mpn_mul_n (up, MPFR_MANT(x), MPFR_MANT(y), n);
if (MPFR_LIMB_MSB (up[un - 1]) == 0)
{
mpn_lshift (up, up, un, 1);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fmma.c b/Build/source/libs/mpfr/mpfr-src/src/fmma.c
index a4d76f118a6..f697a9094d2 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fmma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fmma.c
@@ -1,6 +1,6 @@
/* mpfr_fmma, mpfr_fmms -- Compute a*b +/- c*d
-Copyright 2014-2022 Free Software Foundation, Inc.
+Copyright 2014-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c b/Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c
new file mode 100644
index 00000000000..f1e2fa18371
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/fmod_ui.c
@@ -0,0 +1,72 @@
+/* mpfr_fmod_ui -- modulo a machine integer
+
+Copyright 2000-2004, 2006-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+int
+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",
+ mpfr_get_prec(x), mpfr_log_prec, x, u, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec(r), mpfr_log_prec, r, inex));
+
+ if (MPFR_UNLIKELY (u != 0))
+ {
+ mpfr_t uu;
+#ifdef MPFR_LONG_WITHIN_LIMB
+ mp_limb_t up[1];
+ int cnt;
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_TMP_INIT1 (up, uu, GMP_NUMB_BITS);
+ MPFR_ASSERTN (u == (mp_limb_t) u);
+ count_leading_zeros (cnt, (mp_limb_t) u);
+ *up = (mp_limb_t) u << cnt;
+
+ MPFR_SAVE_EXPO_MARK (expo);
+ MPFR_SET_EXP (uu, GMP_NUMB_BITS - cnt);
+ inex = mpfr_fmod (r, x, uu, rnd_mode);
+#else
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ mpfr_init2 (uu, sizeof (unsigned long) * CHAR_BIT);
+ /* Warning: u might be outside the current exponent range! */
+ MPFR_SAVE_EXPO_MARK (expo);
+ mpfr_set_ui (uu, u, MPFR_RNDZ);
+ inex = mpfr_fmod (r, x, uu, rnd_mode);
+ mpfr_clear (uu);
+#endif /* MPFR_LONG_WITHIN_LIMB */
+ MPFR_SAVE_EXPO_FREE (expo);
+ inex = mpfr_check_range (r, inex, rnd_mode);
+ return inex;
+ }
+ else
+ {
+ MPFR_SET_NAN (r);
+ MPFR_RET_NAN;
+ }
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fms.c b/Build/source/libs/mpfr/mpfr-src/src/fms.c
index 8556ff8325e..b62eff153dc 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fms.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fms.c
@@ -1,6 +1,6 @@
/* mpfr_fms -- Floating multiply-subtract
-Copyright 2001-2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2001-2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fpif.c b/Build/source/libs/mpfr/mpfr-src/src/fpif.c
index 0198da98d23..55e74f52995 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fpif.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fpif.c
@@ -1,7 +1,7 @@
/* mpfr_fpif -- Binary export & import of MPFR numbers
(floating-point interchange format)
-Copyright 2012-2022 Free Software Foundation, Inc.
+Copyright 2012-2023 Free Software Foundation, Inc.
Contributed by Olivier Demengeon.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/frac.c b/Build/source/libs/mpfr/mpfr-src/src/frac.c
index 46fce58a528..2ea2211a48e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/frac.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/frac.c
@@ -1,6 +1,6 @@
/* mpfr_frac -- Fractional part of a floating-point number.
-Copyright 2002-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2002-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/free_cache.c b/Build/source/libs/mpfr/mpfr-src/src/free_cache.c
index 20e7195284f..4f0a82ef119 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/free_cache.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/free_cache.c
@@ -1,6 +1,6 @@
/* mpfr_free_cache... - Free cache/pool memory used by MPFR.
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/frexp.c b/Build/source/libs/mpfr/mpfr-src/src/frexp.c
index 67871df7de0..e4e8cecd39c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/frexp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/frexp.c
@@ -1,6 +1,6 @@
/* mpfr_frexp -- convert to integral and fractional parts
-Copyright 2011-2022 Free Software Foundation, Inc.
+Copyright 2011-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/gamma.c b/Build/source/libs/mpfr/mpfr-src/src/gamma.c
index 103162b4972..f18eb68d338 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/gamma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/gamma.c
@@ -1,6 +1,6 @@
/* mpfr_gamma -- gamma function
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/gamma_inc.c b/Build/source/libs/mpfr/mpfr-src/src/gamma_inc.c
index e0b8ed82efe..6eb3b960c04 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/gamma_inc.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/gamma_inc.c
@@ -1,6 +1,6 @@
/* mpfr_gamma_inc -- incomplete gamma function
-Copyright 2016-2022 Free Software Foundation, Inc.
+Copyright 2016-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c b/Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c
index c718b9bbd09..abef9a630a8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/gammaonethird.c
@@ -1,6 +1,6 @@
/* Functions for evaluating Gamma(1/3) and Gamma(2/3). Used by mpfr_ai.
-Copyright 2010-2022 Free Software Foundation, Inc.
+Copyright 2010-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h b/Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h
index 9353d379b30..dd8915414c6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/gen_inverse.h
@@ -1,6 +1,6 @@
/* generic inverse of a function.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/generic/coverage/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/generic/coverage/mparam.h
index d73a6d94b85..1258f6da976 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/generic/coverage/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/generic/coverage/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h
index 364b5f73928..72ead141e5d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/generic/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_d.c b/Build/source/libs/mpfr/mpfr-src/src/get_d.c
index ab817ff0595..1e7a416b48f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_d.c
@@ -1,7 +1,7 @@
/* mpfr_get_d, mpfr_get_d_2exp -- convert a multiple precision floating-point
number to a machine double precision float
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -42,7 +42,10 @@ mpfr_get_d (mpfr_srcptr src, mpfr_rnd_t rnd_mode)
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
{
if (MPFR_IS_NAN (src))
- return MPFR_DBL_NAN;
+ {
+ /* we don't propagate the sign bit */
+ return MPFR_DBL_NAN;
+ }
negative = MPFR_IS_NEG (src);
@@ -148,7 +151,10 @@ mpfr_get_d_2exp (long *expptr, mpfr_srcptr src, mpfr_rnd_t rnd_mode)
int negative;
*expptr = 0;
if (MPFR_IS_NAN (src))
- return MPFR_DBL_NAN;
+ {
+ /* we don't propagate the sign bit */
+ return MPFR_DBL_NAN;
+ }
negative = MPFR_IS_NEG (src);
if (MPFR_IS_INF (src))
return negative ? MPFR_DBL_INFM : MPFR_DBL_INFP;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_d128.c b/Build/source/libs/mpfr/mpfr-src/src/get_d128.c
index 2cd9f884be7..f97c223a4b6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_d128.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_d128.c
@@ -3,9 +3,9 @@
See https://gcc.gnu.org/legacy-ml/gcc/2006-06/msg00691.html,
https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html,
-and TR 24732 <http://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
+and TR 24732 <https://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
-Copyright 2006-2022 Free Software Foundation, Inc.
+Copyright 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -25,6 +25,23 @@ along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+/* Warning! Do not use any conversion between binary and decimal types,
+ * otherwise GCC will generate from 2 to 3 MB of code (depending on the
+ * GCC version) in the MPFR shared library when the _Decimal128 format
+ * is BID (e.g. on x86).
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96173
+ * https://gforge.inria.fr/tracker/index.php?func=detail&aid=21849&group_id=136&atid=619
+ *
+ * FIXME: Try to save even more space in the MPFR library by avoiding
+ * _Decimal128 operations entirely. These operations now appear only in
+ * string_to_Decimal128(). In the case where the _Decimal128 format is
+ * recognized as BID, this function should be reimplemented directly by
+ * using the specification of the encoding of this format, as already
+ * done for _Decimal64 (see string_to_Decimal64 in get_d64.c).
+ * Or use strtod128 when available, making sure that the string is
+ * locale-independent? (Should one optionally use libdfp for that?)
+ */
+
#include "mpfr-impl.h"
#include "ieee_floats.h"
@@ -40,21 +57,21 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
static _Decimal128
get_decimal128_nan (void)
{
- return 0.0dl / 0.0dl;
+ return 0.dl / 0.dl;
}
/* construct the decimal128 Inf with given sign */
static _Decimal128
get_decimal128_inf (int negative)
{
- return negative ? - 1.0dl / 0.0dl : 1.0dl / 0.0dl;
+ return negative ? - 1.dl / 0.dl : 1.dl / 0.dl;
}
/* construct the decimal128 zero with given sign */
static _Decimal128
get_decimal128_zero (int negative)
{
- return negative ? - 0.0dl : 0.0dl;
+ return negative ? - 0.dl : 0.dl;
}
/* construct the decimal128 smallest non-zero with given sign:
@@ -340,7 +357,10 @@ mpfr_get_decimal128 (mpfr_srcptr src, mpfr_rnd_t rnd_mode)
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
{
if (MPFR_IS_NAN (src))
- return get_decimal128_nan ();
+ {
+ /* we don't propagate the sign bit */
+ return get_decimal128_nan ();
+ }
negative = MPFR_IS_NEG (src);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_d64.c b/Build/source/libs/mpfr/mpfr-src/src/get_d64.c
index 0bd8079c219..3f259cf2af0 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_d64.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_d64.c
@@ -3,9 +3,9 @@
See https://gcc.gnu.org/legacy-ml/gcc/2006-06/msg00691.html,
https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html,
-and TR 24732 <http://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
+and TR 24732 <https://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
-Copyright 2006-2022 Free Software Foundation, Inc.
+Copyright 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -152,7 +152,7 @@ get_decimal64_inf (int negative)
static _Decimal64
get_decimal64_zero (int negative)
{
- return negative ? -0.0dd : 0.0dd;
+ return negative ? -0.dd : 0.dd;
}
/* construct the decimal64 smallest non-zero with given sign:
@@ -513,7 +513,10 @@ mpfr_get_decimal64 (mpfr_srcptr src, mpfr_rnd_t rnd_mode)
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
{
if (MPFR_IS_NAN (src))
- return get_decimal64_nan ();
+ {
+ /* we don't propagate the sign bit */
+ return get_decimal64_nan ();
+ }
negative = MPFR_IS_NEG (src);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_exp.c b/Build/source/libs/mpfr/mpfr-src/src/get_exp.c
index 9fe7e1d2c0d..86b207af618 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_exp.c
@@ -1,6 +1,6 @@
/* mpfr_get_exp - get the exponent of a floating-point number
-Copyright 2002-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2002-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_f.c b/Build/source/libs/mpfr/mpfr-src/src/get_f.c
index 427619fd272..1f2a0e8bb2d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_f.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_f.c
@@ -1,6 +1,6 @@
/* mpfr_get_f -- convert a MPFR number to a GNU MPF number
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -49,8 +49,8 @@ mpfr_get_f (mpf_ptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
MPFR_SET_ERANGEFLAG ();
return 0;
}
- else /* y is plus infinity (resp. minus infinity), set x to the maximum
- value (resp. the minimum value) in precision PREC(x) */
+ else /* y is +inf (resp. -inf); set x to the maximum value
+ (resp. the minimum value) in precision PREC(x) */
{
int i;
mp_limb_t *xp;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_float128.c b/Build/source/libs/mpfr/mpfr-src/src/get_float128.c
index a10eb3a0494..57590065e8b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_float128.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_float128.c
@@ -1,7 +1,7 @@
/* mpfr_get_float128 -- convert a multiple precision floating-point
number to a _Float128 number
-Copyright 2012-2022 Free Software Foundation, Inc.
+Copyright 2012-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_flt.c b/Build/source/libs/mpfr/mpfr-src/src/get_flt.c
index 1c45f67f34e..8adb16f377e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_flt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_flt.c
@@ -1,6 +1,6 @@
/* mpfr_get_flt -- convert a mpfr_t to a machine single precision float
-Copyright 2009-2022 Free Software Foundation, Inc.
+Copyright 2009-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -41,7 +41,10 @@ mpfr_get_flt (mpfr_srcptr src, mpfr_rnd_t rnd_mode)
/* in case of NaN, +Inf, -Inf, +0, -0, the conversion from double to float
is exact */
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (src)))
- return (float) mpfr_get_d (src, rnd_mode);
+ {
+ /* for NaN, we don't propagate the sign bit */
+ return (float) mpfr_get_d (src, rnd_mode);
+ }
e = MPFR_GET_EXP (src);
negative = MPFR_IS_NEG (src);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_ld.c b/Build/source/libs/mpfr/mpfr-src/src/get_ld.c
index ed59e6bd4a0..c8ded5aa7b8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_ld.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_ld.c
@@ -1,7 +1,7 @@
/* mpfr_get_ld, mpfr_get_ld_2exp -- convert a multiple precision floating-point
number to a machine long double
-Copyright 2002-2022 Free Software Foundation, Inc.
+Copyright 2002-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -207,7 +207,10 @@ mpfr_get_ld (mpfr_srcptr x, mpfr_rnd_t rnd_mode)
to get the correct sign (assuming mpfr_get_d supports signed
zeros on the implementation). */
if (s == 0 || DOUBLE_ISNAN (s) || DOUBLE_ISINF (s))
- r = (long double) s;
+ {
+ /* we don't propagate the sign bit of NaN */
+ r = (long double) s;
+ }
else
{
mpfr_t y, z;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_q.c b/Build/source/libs/mpfr/mpfr-src/src/get_q.c
index 1ba7846319f..eb229e51f19 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_q.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_q.c
@@ -1,7 +1,7 @@
/* mpfr_get_q -- get a multiple-precision rational from
a floating-point number
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_si.c b/Build/source/libs/mpfr/mpfr-src/src/get_si.c
index 7f56085d415..eb06d95c6a9 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_si.c
@@ -1,6 +1,6 @@
/* mpfr_get_si -- convert a floating-point number to a signed long.
-Copyright 2003-2022 Free Software Foundation, Inc.
+Copyright 2003-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_sj.c b/Build/source/libs/mpfr/mpfr-src/src/get_sj.c
index 8c644c041f4..f35ffd24996 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_sj.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_sj.c
@@ -1,6 +1,6 @@
/* mpfr_get_sj -- convert a MPFR number to a huge machine signed integer
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 24168f6bf1e..f62df89e970 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_str.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_str.c
@@ -1,6 +1,6 @@
/* mpfr_get_str -- output a floating-point number to a string
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -2484,6 +2484,7 @@ mpfr_ceil_mul (mpfr_exp_t e, int beta, int i)
size_t
mpfr_get_str_ndigits (int b, mpfr_prec_t p)
{
+ size_t ret;
MPFR_SAVE_EXPO_DECL (expo);
MPFR_ASSERTN (2 <= b && b <= 62);
@@ -2505,57 +2506,61 @@ mpfr_get_str_ndigits (int b, mpfr_prec_t p)
1 + ceil(p*log(2)/log(b)) for p < 186564318007 (it returns one more
for p=186564318007 and b=7 or 49) */
MPFR_STAT_STATIC_ASSERT (MPFR_PREC_BITS >= 64 || MPFR_PREC_BITS <= 32);
- if
+ if (
#if MPFR_PREC_BITS >= 64
- /* 64-bit numbers are supported by the C implementation, so that we can
- use the large constant below. If MPFR_PREC_BITS <= 32, the condition
- is always satisfied, so that we do not need any test. */
- (MPFR_LIKELY (p < 186564318007))
+ /* 64-bit numbers are supported by the C implementation, so that we can
+ use the large constant below. */
+ MPFR_LIKELY (p < 186564318007)
#else
- (1)
-#endif
- {
- size_t ret = 1 + mpfr_ceil_mul (IS_POW2(b) ? p - 1 : p, b, 1);
- MPFR_SAVE_EXPO_FREE (expo);
- return ret;
- }
-
- /* Now p is large and b is not a power of two. The code below works for any
- value of p and b, as long as b is not a power of two. Indeed, in such a
- case, p*log(2)/log(b) cannot be exactly an integer, and thus Ziv's loop
- will terminate. */
- {
- mpfr_prec_t w = 77; /* mpfr_ceil_mul used a 77-bit upper approximation of
- log(2)/log(b) */
- mpfr_t d, u;
- size_t ret = 0;
- while (ret == 0)
- {
- w = 2 * w;
- mpfr_init2 (d, w); /* lower approximation */
- mpfr_init2 (u, w); /* upper approximation */
- mpfr_set_ui (d, b, MPFR_RNDU);
- mpfr_set_ui (u, b, MPFR_RNDD);
- mpfr_log2 (d, d, MPFR_RNDU);
- mpfr_log2 (u, u, MPFR_RNDD);
- /* The code below requires that the precision fit in an unsigned long,
- which we currently guarantee (see _MPFR_PREC_FORMAT). */
- MPFR_STAT_STATIC_ASSERT (MPFR_PREC_MAX <= ULONG_MAX);
- /* u <= log(b)/log(2) <= d (***) */
- mpfr_ui_div (d, p, d, MPFR_RNDD);
- mpfr_ui_div (u, p, u, MPFR_RNDU);
- /* d <= p*log(2)/log(b) <= u */
- mpfr_ceil (d, d);
- mpfr_ceil (u, u);
- if (mpfr_cmp (d, u) == 0)
- ret = mpfr_get_ui (d, MPFR_RNDU);
- mpfr_clear (d);
- mpfr_clear (u);
- }
-
- MPFR_SAVE_EXPO_FREE (expo);
- return 1 + ret;
- }
+ /* Since MPFR_PREC_BITS <= 32, the above condition is always satisfied,
+ so that we do not need any test on p. */
+ 1
+#endif
+ )
+ ret = mpfr_ceil_mul (IS_POW2(b) ? p - 1 : p, b, 1);
+ else
+ {
+ /* p is large and b is not a power of two. The code below works
+ for any value of p and b, as long as b is not a power of two.
+ Indeed, in such a case, p*log(2)/log(b) cannot be exactly an
+ integer, and thus Ziv's loop will terminate. */
+ mpfr_prec_t w = 77; /* mpfr_ceil_mul used a 77-bit upper approximation
+ to log(2)/log(b) */
+
+ ret = 0;
+ while (ret == 0)
+ {
+ mpfr_t d, u;
+
+ w = 2 * w;
+ mpfr_init2 (d, w); /* lower approximation */
+ mpfr_init2 (u, w); /* upper approximation */
+ mpfr_set_ui (d, b, MPFR_RNDU);
+ mpfr_set_ui (u, b, MPFR_RNDD);
+ mpfr_log2 (d, d, MPFR_RNDU);
+ mpfr_log2 (u, u, MPFR_RNDD);
+ /* The code below requires that the precision p fit in
+ an unsigned long, which we currently guarantee (see
+ _MPFR_PREC_FORMAT). */
+ MPFR_STAT_STATIC_ASSERT (MPFR_PREC_MAX <= ULONG_MAX);
+ /* u <= log(b)/log(2) <= d (***) */
+ mpfr_ui_div (d, p, d, MPFR_RNDD);
+ mpfr_ui_div (u, p, u, MPFR_RNDU);
+ /* d <= p*log(2)/log(b) <= u */
+ mpfr_ceil (d, d);
+ mpfr_ceil (u, u);
+ if (mpfr_equal_p (d, u))
+ {
+ ret = mpfr_get_ui (d, MPFR_RNDU);
+ MPFR_ASSERTD (ret != 0);
+ }
+ mpfr_clear (d);
+ mpfr_clear (u);
+ }
+ }
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return 1 + ret;
}
/* prints the mantissa of x in the string s, and writes the corresponding
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_ui.c b/Build/source/libs/mpfr/mpfr-src/src/get_ui.c
index 3ebd390ef56..ea5597e1c1f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_ui.c
@@ -1,6 +1,6 @@
/* mpfr_get_ui -- convert a floating-point number to an unsigned long.
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_uj.c b/Build/source/libs/mpfr/mpfr-src/src/get_uj.c
index b325bf074f3..88ef274818d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_uj.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_uj.c
@@ -1,6 +1,6 @@
/* mpfr_get_uj -- convert a MPFR number to a huge machine unsigned integer
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_z.c b/Build/source/libs/mpfr/mpfr-src/src/get_z.c
index 6f046af5580..4341d23e869 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_z.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_z.c
@@ -1,7 +1,7 @@
/* mpfr_get_z -- get a multiple-precision integer from
a floating-point number
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c b/Build/source/libs/mpfr/mpfr-src/src/get_z_2exp.c
index 9d70ca00862..85acbdf33d1 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/get_z_2exp.c
@@ -1,7 +1,7 @@
/* mpfr_get_z_2exp -- get a multiple-precision integer and an exponent
from a floating-point number
-Copyright 2000-2022 Free Software Foundation, Inc.
+Copyright 2000-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/gmp_op.c b/Build/source/libs/mpfr/mpfr-src/src/gmp_op.c
index 9dca0e53e80..cc17ed435f4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/gmp_op.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/gmp_op.c
@@ -1,6 +1,6 @@
/* Implementations of operations between mpfr and mpz/mpq data
-Copyright 2001, 2003-2022 Free Software Foundation, Inc.
+Copyright 2001, 2003-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/grandom.c b/Build/source/libs/mpfr/mpfr-src/src/grandom.c
index b67de5ff9e4..bf5a73b04e3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/grandom.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/grandom.c
@@ -3,7 +3,7 @@
distribution and round it to the precision of rop1, rop2 according
to the given rounding mode.
-Copyright 2011-2022 Free Software Foundation, Inc.
+Copyright 2011-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/hypot.c b/Build/source/libs/mpfr/mpfr-src/src/hypot.c
index 955fdbcb5bc..0d0ba0aae54 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/hypot.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/hypot.c
@@ -1,6 +1,6 @@
/* mpfr_hypot -- Euclidean distance
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h b/Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h
index 06bae4b278e..9ae699c1cb6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/ieee_floats.h
@@ -1,6 +1,6 @@
/* auxiliary data to generate special IEEE floats (NaN, +Inf, -Inf)
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -47,7 +47,7 @@ union dbl_bytes {
quiet NaN (qNaN) or a signaling NaN (sNaN). For instance, HP PA-RISC
is known to do the opposite way of the usual choice recommended in
IEEE 754-2008; see:
- http://grouper.ieee.org/groups/1788/email/msg03272.html
+ https://grouper.ieee.org/groups/1788/email/msg03272.html
Moreover, the right choice is to generate a qNaN in particular because
signaling NaNs are not supported by all compilers (note that the support
diff --git a/Build/source/libs/mpfr/mpfr-src/src/init.c b/Build/source/libs/mpfr/mpfr-src/src/init.c
index 35c50320994..67a8e56dd95 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/init.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/init.c
@@ -1,6 +1,6 @@
/* mpfr_init -- initialize a floating-point number
-Copyright 1999, 2001-2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/init2.c b/Build/source/libs/mpfr/mpfr-src/src/init2.c
index e00b4a30beb..eeadfb8a58d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/init2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/init2.c
@@ -1,6 +1,6 @@
/* mpfr_init2 -- initialize a floating-point number with given precision
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -38,7 +38,9 @@ mpfr_init2 (mpfr_ptr x, mpfr_prec_t p)
/* Check for mp_bits_per_limb (a global variable inside GMP library) */
MPFR_ASSERTN (mp_bits_per_limb == GMP_NUMB_BITS);
- /* Check for correct EXP NAN, ZERO & INF in both mpfr.h and mpfr-impl.h */
+ /* Check for consistent EXP MAX, NAN, ZERO & INF in
+ both mpfr.h and mpfr-impl.h */
+ MPFR_STAT_STATIC_ASSERT( __MPFR_EXP_MAX == MPFR_EXP_MAX );
MPFR_STAT_STATIC_ASSERT( __MPFR_EXP_NAN == MPFR_EXP_NAN );
MPFR_STAT_STATIC_ASSERT( __MPFR_EXP_ZERO == MPFR_EXP_ZERO );
MPFR_STAT_STATIC_ASSERT( __MPFR_EXP_INF == MPFR_EXP_INF );
diff --git a/Build/source/libs/mpfr/mpfr-src/src/inits.c b/Build/source/libs/mpfr/mpfr-src/src/inits.c
index b9aa2596810..f761edce55c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/inits.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/inits.c
@@ -1,6 +1,6 @@
/* mpfr_inits -- initialize several floating-point numbers
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/inits2.c b/Build/source/libs/mpfr/mpfr-src/src/inits2.c
index b59bd75f3ff..2c654b39392 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/inits2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/inits2.c
@@ -1,7 +1,7 @@
/* mpfr_inits2 -- initialize several floating-point numbers with given
precision
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 a56a6b94dec..32e079fa08f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/inp_str.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/inp_str.c
@@ -1,7 +1,7 @@
/* mpfr_inp_str -- input a number in base BASE from stdio stream STREAM
and store the result in ROP
-Copyright 1999, 2001-2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -73,6 +73,10 @@ mpfr_inp_str (mpfr_ptr rop, FILE *stream, int base, mpfr_rnd_t rnd_mode)
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);
if (MPFR_UNLIKELY (str_size == (size_t) -1 || str_size == 0 ||
diff --git a/Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c b/Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c
index d7658e344cf..a1a1ed6949a 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/int_ceil_log2.c
@@ -1,6 +1,6 @@
/* __gmpfr_int_ceil_log2 -- Integer ceil of log2(x)
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/invert_limb.h b/Build/source/libs/mpfr/mpfr-src/src/invert_limb.h
index 6c3e001825a..6a5c73b6625 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/invert_limb.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/invert_limb.h
@@ -1,6 +1,6 @@
/* __gmpfr_invert_limb -- implement GMP's invert_limb (which is not in GMP API)
-Copyright 2016-2022 Free Software Foundation, Inc.
+Copyright 2016-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -26,56 +26,50 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* for now, we only provide __gmpfr_invert_limb for 64-bit limb */
#if GMP_NUMB_BITS == 64
-/* umul_hi(h, x, y) puts in h the high part of x*y */
-#ifdef HAVE_MULX_U64
-#include <immintrin.h>
-#define umul_hi(h, x, y) _mulx_u64 (x, y, (unsigned long long *) &(h))
-#else
-#define umul_hi(h, x, y) \
- do { \
- mp_limb_t _l; \
- umul_ppmm (h, _l, x, y); \
- (void) _l; /* unused variable */ \
- } while (0)
-#endif
-
-/* for 256 <= d9 < 512, invert_limb_table[d9-256] = floor((2^19-3*2^8)/d9)*2^11 */
-static const mp_limb_t invert_limb_table[256] =
- { 2045<<11, 2037<<11, 2029<<11, 2021<<11, 2013<<11, 2005<<11, 1998<<11, 1990<<11,
- 1983<<11, 1975<<11, 1968<<11, 1960<<11, 1953<<11, 1946<<11, 1938<<11, 1931<<11,
- 1924<<11, 1917<<11, 1910<<11, 1903<<11, 1896<<11, 1889<<11, 1883<<11, 1876<<11,
- 1869<<11, 1863<<11, 1856<<11, 1849<<11, 1843<<11, 1836<<11, 1830<<11, 1824<<11,
- 1817<<11, 1811<<11, 1805<<11, 1799<<11, 1792<<11, 1786<<11, 1780<<11, 1774<<11,
- 1768<<11, 1762<<11, 1756<<11, 1750<<11, 1745<<11, 1739<<11, 1733<<11, 1727<<11,
- 1722<<11, 1716<<11, 1710<<11, 1705<<11, 1699<<11, 1694<<11, 1688<<11, 1683<<11,
- 1677<<11, 1672<<11, 1667<<11, 1661<<11, 1656<<11, 1651<<11, 1646<<11, 1641<<11,
- 1636<<11, 1630<<11, 1625<<11, 1620<<11, 1615<<11, 1610<<11, 1605<<11, 1600<<11,
- 1596<<11, 1591<<11, 1586<<11, 1581<<11, 1576<<11, 1572<<11, 1567<<11, 1562<<11,
- 1558<<11, 1553<<11, 1548<<11, 1544<<11, 1539<<11, 1535<<11, 1530<<11, 1526<<11,
- 1521<<11, 1517<<11, 1513<<11, 1508<<11, 1504<<11, 1500<<11, 1495<<11, 1491<<11,
- 1487<<11, 1483<<11, 1478<<11, 1474<<11, 1470<<11, 1466<<11, 1462<<11, 1458<<11,
- 1454<<11, 1450<<11, 1446<<11, 1442<<11, 1438<<11, 1434<<11, 1430<<11, 1426<<11,
- 1422<<11, 1418<<11, 1414<<11, 1411<<11, 1407<<11, 1403<<11, 1399<<11, 1396<<11,
- 1392<<11, 1388<<11, 1384<<11, 1381<<11, 1377<<11, 1374<<11, 1370<<11, 1366<<11,
- 1363<<11, 1359<<11, 1356<<11, 1352<<11, 1349<<11, 1345<<11, 1342<<11, 1338<<11,
- 1335<<11, 1332<<11, 1328<<11, 1325<<11, 1322<<11, 1318<<11, 1315<<11, 1312<<11,
- 1308<<11, 1305<<11, 1302<<11, 1299<<11, 1295<<11, 1292<<11, 1289<<11, 1286<<11,
- 1283<<11, 1280<<11, 1276<<11, 1273<<11, 1270<<11, 1267<<11, 1264<<11, 1261<<11,
- 1258<<11, 1255<<11, 1252<<11, 1249<<11, 1246<<11, 1243<<11, 1240<<11, 1237<<11,
- 1234<<11, 1231<<11, 1228<<11, 1226<<11, 1223<<11, 1220<<11, 1217<<11, 1214<<11,
- 1211<<11, 1209<<11, 1206<<11, 1203<<11, 1200<<11, 1197<<11, 1195<<11, 1192<<11,
- 1189<<11, 1187<<11, 1184<<11, 1181<<11, 1179<<11, 1176<<11, 1173<<11, 1171<<11,
- 1168<<11, 1165<<11, 1163<<11, 1160<<11, 1158<<11, 1155<<11, 1153<<11, 1150<<11,
- 1148<<11, 1145<<11, 1143<<11, 1140<<11, 1138<<11, 1135<<11, 1133<<11, 1130<<11,
- 1128<<11, 1125<<11, 1123<<11, 1121<<11, 1118<<11, 1116<<11, 1113<<11, 1111<<11,
- 1109<<11, 1106<<11, 1104<<11, 1102<<11, 1099<<11, 1097<<11, 1095<<11, 1092<<11,
- 1090<<11, 1088<<11, 1086<<11, 1083<<11, 1081<<11, 1079<<11, 1077<<11, 1074<<11,
- 1072<<11, 1070<<11, 1068<<11, 1066<<11, 1064<<11, 1061<<11, 1059<<11, 1057<<11,
- 1055<<11, 1053<<11, 1051<<11, 1049<<11, 1047<<11, 1044<<11, 1042<<11, 1040<<11,
- 1038<<11, 1036<<11, 1034<<11, 1032<<11, 1030<<11, 1028<<11, 1026<<11, 1024<<11 };
-
-/* for 256 <= d9 < 512, invert_limb_table2[d9-256] = floor((2^19-3*2^8)/d9)^2 */
-static const mp_limb_t invert_limb_table2[256] =
+/* for 256 <= d9 < 512, invert_limb_table[d9-256] = floor((2^19-3*2^8)/d9) */
+static const unsigned short invert_limb_table[256] =
+ { 2045, 2037, 2029, 2021, 2013, 2005, 1998, 1990,
+ 1983, 1975, 1968, 1960, 1953, 1946, 1938, 1931,
+ 1924, 1917, 1910, 1903, 1896, 1889, 1883, 1876,
+ 1869, 1863, 1856, 1849, 1843, 1836, 1830, 1824,
+ 1817, 1811, 1805, 1799, 1792, 1786, 1780, 1774,
+ 1768, 1762, 1756, 1750, 1745, 1739, 1733, 1727,
+ 1722, 1716, 1710, 1705, 1699, 1694, 1688, 1683,
+ 1677, 1672, 1667, 1661, 1656, 1651, 1646, 1641,
+ 1636, 1630, 1625, 1620, 1615, 1610, 1605, 1600,
+ 1596, 1591, 1586, 1581, 1576, 1572, 1567, 1562,
+ 1558, 1553, 1548, 1544, 1539, 1535, 1530, 1526,
+ 1521, 1517, 1513, 1508, 1504, 1500, 1495, 1491,
+ 1487, 1483, 1478, 1474, 1470, 1466, 1462, 1458,
+ 1454, 1450, 1446, 1442, 1438, 1434, 1430, 1426,
+ 1422, 1418, 1414, 1411, 1407, 1403, 1399, 1396,
+ 1392, 1388, 1384, 1381, 1377, 1374, 1370, 1366,
+ 1363, 1359, 1356, 1352, 1349, 1345, 1342, 1338,
+ 1335, 1332, 1328, 1325, 1322, 1318, 1315, 1312,
+ 1308, 1305, 1302, 1299, 1295, 1292, 1289, 1286,
+ 1283, 1280, 1276, 1273, 1270, 1267, 1264, 1261,
+ 1258, 1255, 1252, 1249, 1246, 1243, 1240, 1237,
+ 1234, 1231, 1228, 1226, 1223, 1220, 1217, 1214,
+ 1211, 1209, 1206, 1203, 1200, 1197, 1195, 1192,
+ 1189, 1187, 1184, 1181, 1179, 1176, 1173, 1171,
+ 1168, 1165, 1163, 1160, 1158, 1155, 1153, 1150,
+ 1148, 1145, 1143, 1140, 1138, 1135, 1133, 1130,
+ 1128, 1125, 1123, 1121, 1118, 1116, 1113, 1111,
+ 1109, 1106, 1104, 1102, 1099, 1097, 1095, 1092,
+ 1090, 1088, 1086, 1083, 1081, 1079, 1077, 1074,
+ 1072, 1070, 1068, 1066, 1064, 1061, 1059, 1057,
+ 1055, 1053, 1051, 1049, 1047, 1044, 1042, 1040,
+ 1038, 1036, 1034, 1032, 1030, 1028, 1026, 1024 };
+
+/* for 256 <= d9 < 512, invert_limb_table2[d9-256] = floor((2^19-3*2^8)/d9)^2
+ *
+ * Note: This table requires 4182025 to be representable in unsigned int,
+ * thus disallows 16-bit int, for instance. However, this code is under
+ * "#if GMP_NUMB_BITS == 64", and a system with int smaller than 32 bits
+ * should better be used with GMP_NUMB_BITS == 32 (or 16 if supported).
+ * This constraint is checked with MPFR_STAT_STATIC_ASSERT below.
+ */
+static const unsigned int invert_limb_table2[256] =
{ 4182025, 4149369, 4116841, 4084441, 4052169, 4020025, 3992004, 3960100, 3932289,
3900625, 3873024, 3841600, 3814209, 3786916, 3755844, 3728761, 3701776, 3674889,
3648100, 3621409, 3594816, 3568321, 3545689, 3519376, 3493161, 3470769, 3444736,
@@ -112,9 +106,12 @@ static const mp_limb_t invert_limb_table2[256] =
#define __gmpfr_invert_limb(r, d) \
do { \
mp_limb_t _d, _d0, _i, _d40, _d63, _v0, _v1, _v2, _e, _v3, _h, _l; \
+ MPFR_STAT_STATIC_ASSERT (4182025 <= UINT_MAX); \
_d = (d); \
_i = (_d >> 55) - 256; /* i = d9 - 256 */ \
- _v0 = invert_limb_table[_i]; \
+ /* the shift by 11 is for free since it is hidden in the */ \
+ /* invert_limb_table2[_i] * _d40 multiplication latency */ \
+ _v0 = (mp_limb_t) invert_limb_table[_i] << 11; \
_d40 = (_d >> 24) + 1; \
_v1 = _v0 - ((invert_limb_table2[_i] * _d40) >> 40) - 1; \
_v2 = (_v1 << 13) + \
@@ -136,9 +133,10 @@ static const mp_limb_t invert_limb_table2[256] =
#define __gmpfr_invert_limb_approx(r, d) \
do { \
mp_limb_t _d, _d0, _i, _d40, _d63, _v0, _v1, _v2, _e, _h; \
+ MPFR_STAT_STATIC_ASSERT (4182025 <= UINT_MAX); \
_d = (d); \
_i = (_d >> 55) - 256; /* i = d9 - 256 */ \
- _v0 = invert_limb_table[_i]; \
+ _v0 = (mp_limb_t) invert_limb_table[_i] << 11; \
_d40 = (_d >> 24) + 1; \
_v1 = _v0 - ((invert_limb_table2[_i] * _d40) >> 40) - 1; \
_v2 = (_v1 << 13) + \
@@ -153,7 +151,7 @@ static const mp_limb_t invert_limb_table2[256] =
#elif GMP_NUMB_BITS == 32
/* for 512 <= d10 < 1024, l[d10-512] = floor((2^24-2^14+2^9)/d10) */
-static const mp_limb_t invert_limb_table[512] =
+static const unsigned short invert_limb_table[512] =
{ 32737, 32673, 32609, 32546, 32483, 32420, 32357, 32295, 32233, 32171,
32109, 32048, 31987, 31926, 31865, 31805, 31744, 31684, 31625, 31565,
31506, 31447, 31388, 31329, 31271, 31212, 31154, 31097, 31039, 30982,
diff --git a/Build/source/libs/mpfr/mpfr-src/src/invsqrt_limb.h b/Build/source/libs/mpfr/mpfr-src/src/invsqrt_limb.h
index ed92d907705..161632225c3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/invsqrt_limb.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/invsqrt_limb.h
@@ -1,6 +1,6 @@
/* __gmpfr_invsqrt_limb_approx -- reciprocal approximate square root of a limb
-Copyright 2017-2022 Free Software Foundation, Inc.
+Copyright 2017-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -29,7 +29,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* For 257 <= d10 <= 1024, T[d10-257] = floor(sqrt(2^30/d10)).
Sage code:
T = [floor(sqrt(2^30/d10)) for d10 in [257..1024]] */
-static const mp_limb_t T[768] =
+static const unsigned short T[768] =
{ 2044, 2040, 2036, 2032, 2028, 2024, 2020, 2016, 2012, 2009, 2005,
2001, 1997, 1994, 1990, 1986, 1983, 1979, 1975, 1972, 1968, 1965, 1961,
1958, 1954, 1951, 1947, 1944, 1941, 1937, 1934, 1930, 1927, 1924, 1920,
@@ -228,19 +228,6 @@ static const mp_limb_t T3[768] =
1083206683, 1080045576, 1080045576, 1076890625, 1076890625, 1073741824,
1073741824 };
-/* umul_hi(h, x, y) puts in h the high part of x*y */
-#ifdef HAVE_MULX_U64
-#include <immintrin.h>
-#define umul_hi(h, x, y) _mulx_u64 (x, y, (unsigned long long *) &(h))
-#else
-#define umul_hi(h, x, y) \
- do { \
- mp_limb_t _l; \
- umul_ppmm (h, _l, x, y); \
- (void) _l; /* unused variable */ \
- } while (0)
-#endif
-
/* given 2^62 <= d < 2^64, put in r an approximation of
s = floor(2^96/sqrt(d)) - 2^64, with r <= s <= r + 15 */
#define __gmpfr_invsqrt_limb_approx(r, d) \
diff --git a/Build/source/libs/mpfr/mpfr-src/src/isinf.c b/Build/source/libs/mpfr/mpfr-src/src/isinf.c
index 7a4630c3012..c051a70a913 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/isinf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/isinf.c
@@ -1,6 +1,6 @@
/* mpfr_inf_p -- check for infinities
-Copyright 2000-2001, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2001, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/isinteger.c b/Build/source/libs/mpfr/mpfr-src/src/isinteger.c
index c2a8188321d..b829ce53626 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/isinteger.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/isinteger.c
@@ -1,6 +1,6 @@
/* mpfr_integer_p -- test if a mpfr variable is integer.
-Copyright 2001-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2001-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/isnan.c b/Build/source/libs/mpfr/mpfr-src/src/isnan.c
index 6d9b5dab77e..c5cc9e9fbcd 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/isnan.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/isnan.c
@@ -1,6 +1,6 @@
/* mpfr_nan_p -- check for NaN
-Copyright 2000-2001, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2001, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/isnum.c b/Build/source/libs/mpfr/mpfr-src/src/isnum.c
index f96faf15872..7f09427782b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/isnum.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/isnum.c
@@ -1,6 +1,6 @@
/* mpfr_number_p -- check for ordinary numbers
-Copyright 2000-2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/isqrt.c b/Build/source/libs/mpfr/mpfr-src/src/isqrt.c
index 1ffa9231b59..f50e1626a97 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/isqrt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/isqrt.c
@@ -1,6 +1,6 @@
/* __gmpfr_isqrt && __gmpfr_cuberoot -- Integer square root and cube root
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/isregular.c b/Build/source/libs/mpfr/mpfr-src/src/isregular.c
index da3a5c50ce4..681c500e1a7 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/isregular.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/isregular.c
@@ -1,6 +1,6 @@
/* mpfr_regular_p -- check for regular number (neither NaN, Inf or zero)
-Copyright 2009-2022 Free Software Foundation, Inc.
+Copyright 2009-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/iszero.c b/Build/source/libs/mpfr/mpfr-src/src/iszero.c
index afeb99aa1fd..e374b9900ec 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/iszero.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/iszero.c
@@ -1,6 +1,6 @@
/* mpfr_zero_p -- check for zero
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/jn.c b/Build/source/libs/mpfr/mpfr-src/src/jn.c
index 43c2f020b41..5a92f9cee48 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/jn.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/jn.c
@@ -1,7 +1,7 @@
/* mpfr_j0, mpfr_j1, mpfr_jn -- Bessel functions of 1st kind, integer order.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/j0.html
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c b/Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c
index 49d6335d049..036339f78a3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/jyn_asympt.c
@@ -1,6 +1,6 @@
/* mpfr_jn_asympt, mpfr_yn_asympt -- shared code for mpfr_jn and mpfr_yn
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -290,8 +290,8 @@ FUNCTION (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r)
}
MPFR_ZIV_FREE (loop);
- inex = (MPFR_IS_POS(z) || ((n & 1) == 0)) ? mpfr_set (res, c, r)
- : mpfr_neg (res, c, r);
+ inex = mpfr_set4 (res, c, r, MPFR_IS_POS (z) || (n & 1) == 0 ?
+ MPFR_SIGN (c) : - MPFR_SIGN (c));
mpfr_clear (c);
/* for RNDF, mpfr_set or mpfr_neg may return 0, but if we return 0, it
diff --git a/Build/source/libs/mpfr/mpfr-src/src/li2.c b/Build/source/libs/mpfr/mpfr-src/src/li2.c
index bae05aa7e63..901894e47b9 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/li2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/li2.c
@@ -1,6 +1,6 @@
/* mpfr_li2 -- Dilogarithm.
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/lngamma.c b/Build/source/libs/mpfr/mpfr-src/src/lngamma.c
index 98416d95740..b68044a0182 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/lngamma.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/lngamma.c
@@ -1,6 +1,6 @@
/* mpfr_lngamma -- lngamma function
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -284,7 +284,7 @@ GAMMA_FUNC (mpfr_ptr y, mpfr_srcptr z0, mpfr_rnd_t rnd)
case if we assume lngamma(z0) cannot be exact, the other flag
should be correct. We are conservative here and request that both
inexact flags agree. */
- ok = SAME_SIGN (inex1, inex2) && mpfr_cmp (l, h) == 0;
+ ok = SAME_SIGN (inex1, inex2) && mpfr_equal_p (l, h);
if (ok)
mpfr_set (y, h, rnd); /* exact */
mpfr_clear (l);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log.c b/Build/source/libs/mpfr/mpfr-src/src/log.c
index 4d99b5b3e9d..677fcc3d6e4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log.c
@@ -1,6 +1,6 @@
/* mpfr_log -- natural logarithm of a floating-point number
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -121,6 +121,7 @@ mpfr_log (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, p);
for (;;)
{
+ mpfr_t scaled_a;
mpfr_exp_t m;
mpfr_exp_t cancel;
@@ -131,19 +132,18 @@ mpfr_log (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
/* In standard configuration (_MPFR_EXP_FORMAT <= 3), one has
mpfr_exp_t <= long, so that the following assertion is always
- true. */
+ true. This assertion is needed for the mpfr_mul_si below. */
MPFR_ASSERTN (m >= LONG_MIN && m <= LONG_MAX);
- /* FIXME: Why 1 ulp and not 1/2 ulp? Ditto with some other ones
- below. The error concerning the AGM should be explained since
- 4/s is inexact (one needs a bound on its derivative). */
- mpfr_mul_2si (tmp2, a, m, MPFR_RNDN); /* s=a*2^m, err<=1 ulp */
- MPFR_ASSERTD (MPFR_EXP (tmp2) >= (p + 3) / 2);
+ /* FIXME: Redo the error analysis. The error concerning the AGM
+ should be explained since 4/s is inexact (one needs a bound
+ on its derivative). */
+ MPFR_ALIAS (scaled_a, a, MPFR_SIGN_POS, (p + 3) / 2); /* s=a*2^m */
/* [FIXME] and one can have the equality, even if p is even.
This means that if a is a power of 2 and p is even, then
s = (1/2) * 2^((p+2)/2) = 2^(p/2), so that the condition
s > 2^(p/2) from algorithms.tex is not satisfied. */
- mpfr_div (tmp1, __gmpfr_four, tmp2, MPFR_RNDN);/* 4/s, err<=2 ulps */
+ mpfr_div (tmp1, __gmpfr_four, scaled_a, MPFR_RNDF); /* 4/s, err<=2 ulps */
mpfr_agm (tmp2, __gmpfr_one, tmp1, MPFR_RNDN); /* AG(1,4/s),err<=3 ulps */
mpfr_mul_2ui (tmp2, tmp2, 1, MPFR_RNDN); /* 2*AG(1,4/s), err<=3 ulps */
mpfr_const_pi (tmp1, MPFR_RNDN); /* compute pi, err<=1ulp */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log10.c b/Build/source/libs/mpfr/mpfr-src/src/log10.c
index 57fb4b11abb..a045ef155bc 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log10.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log10.c
@@ -1,6 +1,6 @@
/* mpfr_log10 -- logarithm in base 10.
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -129,7 +129,7 @@ mpfr_log10 (mpfr_ptr r, mpfr_srcptr a, mpfr_rnd_t rnd_mode)
if (MPFR_IS_POS (t)
&& mpfr_integer_p (t) && mpfr_fits_ulong_p (t, MPFR_RNDN)
&& !mpfr_ui_pow_ui (tt, 10, mpfr_get_ui (t, MPFR_RNDN), MPFR_RNDN)
- && mpfr_cmp (a, tt) == 0)
+ && mpfr_equal_p (a, tt))
break;
/* actualization of the precision */
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log10p1.c b/Build/source/libs/mpfr/mpfr-src/src/log10p1.c
new file mode 100644
index 00000000000..01856442c2f
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/log10p1.c
@@ -0,0 +1,210 @@
+/* mpfr_log10p1 -- Compute log10(1+x)
+
+Copyright 2001-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H /* needed for MPFR_INT_CEIL_LOG2 */
+#include "mpfr-impl.h"
+
+#define ULSIZE (sizeof (unsigned long) * CHAR_BIT)
+
+/* Return non-zero if log10(1+x) is exactly representable in infinite
+ precision, and in such case the returned value is k such that 1+x = 10^k
+ (the case k=0 cannot happen since we assume x<>0). */
+static mpfr_exp_t
+mpfr_log10p1_exact_p (mpfr_srcptr x)
+{
+ /* log10(1+x) is exactly representable when 1+x is a power of 10,
+ we thus simply compute 1+x with enough precision and check whether
+ the addition is exact. This routine is called with extended exponent
+ range, thus no need to extend it. */
+ mpfr_t t;
+ int inex, ret = 0;
+
+ MPFR_ASSERTD(!MPFR_IS_SINGULAR(x));
+ if (MPFR_IS_NEG(x) || MPFR_EXP(x) <= 3) /* x < 8 */
+ return 0;
+ mpfr_init2 (t, MPFR_PREC(x));
+ inex = mpfr_add_ui (t, x, 1, MPFR_RNDZ);
+ if (inex == 0) /* otherwise 1+x = 2^k, and cannot be a power of 10 */
+ {
+ mpfr_prec_t trailing_x = mpfr_min_prec (x);
+ mpfr_prec_t trailing_t = mpfr_min_prec (t);
+ if (trailing_x > trailing_t)
+ {
+ mpfr_prec_t k = trailing_x - trailing_t;
+ /* if 1+x = 10^k, then t has k more trailing zeros than x */
+ mpz_t z;
+ mpfr_t y;
+ mpz_init (z);
+ mpz_ui_pow_ui (z, 5, k);
+ mpfr_init2 (y, mpz_sizeinbase (z, 2));
+ mpfr_set_z_2exp (y, z, k, MPFR_RNDZ);
+ if (mpfr_equal_p (t, y))
+ ret = k;
+ mpfr_clear (y);
+ mpz_clear (z);
+ }
+ }
+ mpfr_clear (t);
+ return ret;
+}
+
+/* Deal with the case where x is small, so that log10(1+x) ~ x/log(10).
+ In case we can round correctly, put in y the correctly-rounded value,
+ and return the corresponding ternary value (which cannot be zero).
+ Otherwise return 0.
+ This routine cannot be called only once after the first failure of Ziv's
+ strategy, since it might be that it fails the first time, thus we need
+ to pass the (increasing) working precision 'prec'.
+ In case of underflow, we set y to 0, and let the caller call
+ mpfr_underflow. */
+static int
+mpfr_log10p1_small (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode,
+ mpfr_prec_t prec)
+{
+ mpfr_t t;
+ mpfr_exp_t e = MPFR_GET_EXP(x);
+ int inex;
+
+ /* for |x| < 1/2, |log10(x+1) - x/log(10)| < x^2/log(10) */
+ if (e > - (mpfr_exp_t) MPFR_PREC(y))
+ return 0; /* the term in x^2 will contribute */
+ /* now e = EXP(x) <= -PREC(y) <= -1 which ensures |x| < 1/2 */
+ mpfr_init2 (t, prec);
+ mpfr_log_ui (t, 10, MPFR_RNDN);
+ MPFR_SET_EXP (t, MPFR_GET_EXP (t) - 2);
+ /* we divide x by log(10)/4 which is smaller than 1 to avoid any underflow */
+ mpfr_div (t, x, t, MPFR_RNDN);
+ if (MPFR_GET_EXP (t) < __gmpfr_emin + 2) /* underflow case */
+ {
+ MPFR_SET_ZERO(y); /* the sign does not matter */
+ inex = 1;
+ }
+ else
+ {
+ MPFR_SET_EXP (t, MPFR_GET_EXP (t) - 2);
+ /* t = x/log(10) * (1 + theta)^2 where |theta| < 2^-prec.
+ For prec>=2, |(1 + theta)^2 - 1| < 3*theta thus the error is
+ bounded by 3 ulps. The error term in x^2 is bounded by |t*x|,
+ which is less than |t|*2^e < 2^(EXP(t)+e). */
+ e += prec;
+ /* now the error is bounded by 2^e+3 ulps */
+ e = (e >= 2) ? e + 1 : 3;
+ /* now the error is bounded by 2^e ulps */
+ if (MPFR_CAN_ROUND (t, prec - e, MPFR_PREC(y), rnd_mode))
+ inex = mpfr_set (y, t, rnd_mode);
+ else
+ inex = 0;
+ }
+ mpfr_clear (t);
+ return inex;
+}
+
+/* The computation of log10p1 is done by log10p1(x) = log1p(x)/log(2) */
+int
+mpfr_log10p1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int comp, inexact, nloop;
+ mpfr_t t, lg10;
+ mpfr_prec_t Ny = MPFR_PREC(y), prec;
+ MPFR_ZIV_DECL (loop);
+ 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,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return mpfr_log1p (y, x, rnd_mode); /* same result for singular cases */
+
+ comp = mpfr_cmp_si (x, -1);
+ /* log10p1(x) is undefined for x < -1 */
+ if (MPFR_UNLIKELY(comp <= 0))
+ {
+ if (comp == 0)
+ /* x=0: log10p1(-1)=-inf (divide-by-zero exception) */
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_NEG (y);
+ MPFR_SET_DIVBY0 ();
+ MPFR_RET (0);
+ }
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ prec = Ny + MPFR_INT_CEIL_LOG2 (Ny) + 6;
+
+ mpfr_init2 (t, prec);
+ mpfr_init2 (lg10, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (nloop = 0; ; nloop++)
+ {
+ mpfr_log1p (t, x, MPFR_RNDN);
+ mpfr_log_ui (lg10, 10, MPFR_RNDN);
+ mpfr_div (t, t, lg10, MPFR_RNDN);
+ /* t = log10(1+x) * (1 + theta)^3 where |theta| < 2^-prec,
+ for prec >= 2 we have |(1 + theta)^3 - 1| < 4*theta. */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, prec - 2, Ny, rnd_mode)))
+ break;
+
+ if (nloop == 0)
+ {
+ /* check for exact cases */
+ mpfr_exp_t k;
+
+ MPFR_LOG_MSG (("check for exact cases\n", 0));
+ k = mpfr_log10p1_exact_p (x);
+ if (k != 0) /* 1+x = 10^k */
+ {
+ inexact = mpfr_set_si (y, k, rnd_mode);
+ goto end;
+ }
+ }
+
+ /* inexact will be the non-zero ternary value if rounding could be
+ done, otherwise it is set to 0. */
+ inexact = mpfr_log10p1_small (y, x, rnd_mode, prec);
+ if (inexact)
+ goto end;
+
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (t, prec);
+ mpfr_set_prec (lg10, prec);
+ }
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ end:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ mpfr_clear (lg10);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ if (MPFR_IS_ZERO(y)) /* underflow from mpfr_log10p1_small */
+ return mpfr_underflow (y, (rnd_mode == MPFR_RNDN) ? MPFR_RNDZ : rnd_mode,
+ 1);
+ else
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log1p.c b/Build/source/libs/mpfr/mpfr-src/src/log1p.c
index 41955e5b7b7..87f35e07c57 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log1p.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log1p.c
@@ -1,6 +1,6 @@
/* mpfr_log1p -- Compute log(1+x)
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -24,8 +24,8 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-impl.h"
/* Put in y an approximation of log(1+x) for x small.
- We assume |x| < 1, in which case:
- |x/2| <= |log(1+x)| = |x - x^2/2 + x^3/3 - x^4/4 + ...| <= |x|.
+ We assume |x| < 1/2, in which case:
+ |x/2| <= |log(1+x)| <= |2x|.
Return k such that the error is bounded by 2^k*ulp(y).
*/
static int
@@ -36,7 +36,7 @@ mpfr_log1p_small (mpfr_ptr y, mpfr_srcptr x)
unsigned long i;
int k;
- MPFR_ASSERTD(MPFR_GET_EXP (x) <= 0); /* ensures |x| < 1 */
+ MPFR_ASSERTD(MPFR_GET_EXP (x) <= -1); /* ensures |x| < 1/2 */
/* in the following, theta represents a value with |theta| <= 2^(1-p)
(might be a different value each time) */
@@ -202,8 +202,8 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
variant whenever EXP(x) <= -p/log2(p). */
k = 1 + __gmpfr_int_ceil_log2 (Ny); /* the +1 avoids a division by 0
when Ny=1 */
- if (MPFR_GET_EXP (x) <= - (mpfr_exp_t) (Ny / k))
- /* this implies EXP(x) <= 0 thus x < 1 */
+ if (MPFR_GET_EXP (x) + 1 <= - (mpfr_exp_t) (Ny / k))
+ /* this implies EXP(x) <= -1 thus x < 1/2 */
err = Nt - mpfr_log1p_small (t, x);
else
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log2.c b/Build/source/libs/mpfr/mpfr-src/src/log2.c
index e34e23a2cc4..310ec985251 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log2.c
@@ -1,6 +1,6 @@
/* mpfr_log2 -- log base 2
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log2p1.c b/Build/source/libs/mpfr/mpfr-src/src/log2p1.c
new file mode 100644
index 00000000000..ac0bdd6170d
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/log2p1.c
@@ -0,0 +1,168 @@
+/* mpfr_log2p1 -- Compute log2(1+x)
+
+Copyright 2001-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H /* needed for MPFR_INT_CEIL_LOG2 */
+#include "mpfr-impl.h"
+
+#define ULSIZE (sizeof (unsigned long) * CHAR_BIT)
+
+/* return non-zero if log2(1+x) is exactly representable in infinite precision,
+ and in such case the returned value is k such that 1+x = 2^k (the case k=0
+ cannot happen since we assume x<>0) */
+static mpfr_exp_t
+mpfr_log2p1_isexact (mpfr_srcptr x)
+{
+ /* log2(1+x) is exactly representable when 1+x is a power of two,
+ we thus simply compute 1+x with 1-bit precision and check whether
+ the addition is exact. This routine is called with extended exponent
+ range, thus no need to extend it. */
+ mpfr_t t;
+ int inex;
+ mpfr_exp_t e;
+
+ mpfr_init2 (t, 1);
+ inex = mpfr_add_ui (t, x, 1, MPFR_RNDZ);
+ e = MPFR_GET_EXP (t);
+ mpfr_clear (t);
+ return inex == 0 ? e - 1 : 0;
+}
+
+/* in case x=2^k and we can decide of the correct rounding,
+ put the correctly-rounded value in y and return the corresponding
+ ternary value (which is necessarily non-zero),
+ otherwise return 0 */
+static int
+mpfr_log2p1_special (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ mpfr_exp_t expx = MPFR_GET_EXP(x);
+ mpfr_exp_t k = expx - 1, expk;
+ mpfr_prec_t prec;
+ mpfr_t t;
+ int inex;
+
+ if (k <= 0 || mpfr_cmp_si_2exp (x, 1, k) != 0)
+ return 0;
+ /* k < log2(1+x) < k + 1/x/log(2) < k + 2/x */
+ expk = MPFR_INT_CEIL_LOG2(k); /* exponent of k */
+ /* 2/x < 2^(2-EXP(x)) thus if 2-EXP(x) < expk - PREC(y) - 1,
+ we have 2/x < 1/4*ulp(k) and we can decide the correct rounding */
+ if (2 - expx >= expk - MPFR_PREC(y) - 1)
+ return 0;
+ prec = (MPFR_PREC(y) + 2 <= ULSIZE) ? ULSIZE : MPFR_PREC(y) + 2;
+ mpfr_init2 (t, prec);
+ mpfr_set_ui (t, k, MPFR_RNDZ); /* exact since prec >= ULSIZE */
+ mpfr_nextabove (t);
+ /* now k < t < k + 2/x and round(t) = round(log2(1+x)) */
+ inex = mpfr_set (y, t, rnd_mode);
+ mpfr_clear (t);
+ /* Warning: for RNDF, the mpfr_set calls above might return 0 */
+ return (rnd_mode == MPFR_RNDF) ? 1 : inex;
+}
+
+/* The computation of log2p1 is done by log2p1(x) = log1p(x)/log(2) */
+int
+mpfr_log2p1 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ int comp, inexact, nloop;
+ mpfr_t t, lg2;
+ mpfr_prec_t Ny = MPFR_PREC(y), prec;
+ MPFR_ZIV_DECL (loop);
+ 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,
+ inexact));
+
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ return mpfr_log1p (y, x, rnd_mode); /* same result for singular cases */
+
+ comp = mpfr_cmp_si (x, -1);
+ /* log2p1(x) is undefined for x < -1 */
+ if (MPFR_UNLIKELY(comp <= 0))
+ {
+ if (comp == 0)
+ /* x=0: log2p1(-1)=-inf (divide-by-zero exception) */
+ {
+ MPFR_SET_INF (y);
+ MPFR_SET_NEG (y);
+ MPFR_SET_DIVBY0 ();
+ MPFR_RET (0);
+ }
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ prec = Ny + MPFR_INT_CEIL_LOG2 (Ny) + 6;
+
+ mpfr_init2 (t, prec);
+ mpfr_init2 (lg2, prec);
+
+ MPFR_ZIV_INIT (loop, prec);
+ for (nloop = 0; ; nloop++)
+ {
+ mpfr_log1p (t, x, MPFR_RNDN);
+ mpfr_const_log2 (lg2, MPFR_RNDN);
+ mpfr_div (t, t, lg2, MPFR_RNDN);
+ /* t = log2(1+x) * (1 + theta)^3 where |theta| < 2^-prec,
+ for prec >= 2 we have |(1 + theta)^3 - 1| < 4*theta.
+ Note: contrary to log10p1, no underflow is possible in extended
+ exponent range, since for tiny x, |log2(1+x)| ~ |x|/log(2) >= |x|,
+ and x is representable, thus x/log(2) too. */
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, prec - 2, Ny, rnd_mode)))
+ break;
+
+ if (nloop == 0)
+ {
+ /* check for exact cases */
+ mpfr_exp_t k;
+
+ MPFR_LOG_MSG (("check for exact cases\n", 0));
+ k = mpfr_log2p1_isexact (x);
+ if (k != 0) /* 1+x = 2^k */
+ {
+ inexact = mpfr_set_si (y, k, rnd_mode);
+ goto end;
+ }
+
+ /* if x = 2^k with huge k, Ziv's loop will fail */
+ inexact = mpfr_log2p1_special (y, x, rnd_mode);
+ if (inexact != 0)
+ goto end;
+ }
+
+ MPFR_ZIV_NEXT (loop, prec);
+ mpfr_set_prec (t, prec);
+ mpfr_set_prec (lg2, prec);
+ }
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ end:
+ MPFR_ZIV_FREE (loop);
+ mpfr_clear (t);
+ mpfr_clear (lg2);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/log_ui.c b/Build/source/libs/mpfr/mpfr-src/src/log_ui.c
index 1e597b7d0b2..ec8b6dbe73b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/log_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/log_ui.c
@@ -1,6 +1,6 @@
/* mpfr_log_ui -- compute natural logarithm of an unsigned long
-Copyright 2014-2022 Free Software Foundation, Inc.
+Copyright 2014-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -146,7 +146,7 @@ mpfr_log_ui (mpfr_ptr x, unsigned long n, mpfr_rnd_t rnd_mode)
Since |p| <= LONG_MAX, if n > LONG_MAX, this means that p < 0 and
-n as an unsigned long value is at most LONG_MAX, thus fits in a
long. */
- p = n > LONG_MAX ? - (long) - n : (long) n;
+ p = ULONG2LONG (n);
MPFR_TMP_MARK(marker);
w = MPFR_PREC(x) + MPFR_INT_CEIL_LOG2 (MPFR_PREC(x)) + 10;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/logging.c b/Build/source/libs/mpfr/mpfr-src/src/logging.c
index 451e57886be..2f32603c1bf 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/logging.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/logging.c
@@ -1,6 +1,6 @@
/* MPFR Logging functions.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/min_prec.c b/Build/source/libs/mpfr/mpfr-src/src/min_prec.c
index 89ece52f015..a4a63dda973 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/min_prec.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/min_prec.c
@@ -1,6 +1,6 @@
/* mpfr_min_prec -- minimal size in bits to hold the mantissa
-Copyright 2009-2022 Free Software Foundation, Inc.
+Copyright 2009-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/minmax.c b/Build/source/libs/mpfr/mpfr-src/src/minmax.c
index ab9fde6c93b..a54497faaa0 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/minmax.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/minmax.c
@@ -1,6 +1,6 @@
/* mpfr_min -- min and max of x, y
-Copyright 2001, 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2001, 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mips/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/mips/mparam.h
index 5be54d53ed7..b8a009d8d0a 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mips/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mips/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/modf.c b/Build/source/libs/mpfr/mpfr-src/src/modf.c
index e86da2a900f..5f1377bb32f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/modf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/modf.c
@@ -1,6 +1,6 @@
/* mpfr_modf -- Integral and fractional part.
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c b/Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c
index 6c59d2fca9e..d9cca7c0389 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mp_clz_tab.c
@@ -3,7 +3,7 @@
THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND MAY CHANGE
INCOMPATIBLY OR DISAPPEAR IN A FUTURE GNU MPFR RELEASE.
-Copyright 1991, 1993-1994, 1996-1997, 2000-2001, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1991, 1993-1994, 1996-1997, 2000-2001, 2004, 2006-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
It has been copied and adapted from the GNU MP Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mparam_h.in b/Build/source/libs/mpfr/mpfr-src/src/mparam_h.in
index 8c5aa1dfba8..261378f4924 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mparam_h.in
+++ b/Build/source/libs/mpfr/mpfr-src/src/mparam_h.in
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
@@ -29,7 +29,14 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "generic/coverage/mparam.h"
/* Note: the different macros used here are those defined by gcc,
- for example with gcc -mtune=native -dM -E -xc /dev/null */
+ for example with "gcc -mtune=native -dM -E -xc /dev/null".
+
+ The best parameters may depend on the local machine, not just
+ the architecture or even the target processor as accepted by
+ -mtune. Target-related options set by GCC can be obtained with
+ the "-Q --help=target --help=params" options (in addition to
+ -march=... and -mtune=...).
+ See https://gcc.gnu.org/pipermail/gcc-help/2021-September/140720.html */
#elif 1 /* no processor specific optimization for TeX Live */
#define MPFR_TUNE_CASE "default"
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h b/Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h
index ed2b8f2f42b..648546c1e99 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpf2mpfr.h
@@ -1,6 +1,6 @@
/* mpf2mpfr.h -- Compatibility include file with mpf.
-Copyright 1999-2002, 2004-2022 Free Software Foundation, Inc.
+Copyright 1999-2002, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-cvers.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-cvers.h
index 0944bbbb071..2ee737fd0bb 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-cvers.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-cvers.h
@@ -1,6 +1,6 @@
/* Utilities for MPFR developers, not exported.
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -45,6 +45,12 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define __MPFR_MAJMIN(a,i) (((a) << 8) | (i))
+/* Instead of __MPFR_MAJMIN below, we could use code like
+ (__MAJ__ + (__MIN__ >= (i)) > (a))
+ as in the patch at
+ https://sympa.inria.fr/sympa/arc/mpfr/2022-12/msg00007.html
+*/
+
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && ! __MPFR_ICC(0,0,0)
# define __MPFR_GNUC(a,i) \
(__MPFR_MAJMIN(__GNUC__,__GNUC_MINOR__) >= __MPFR_MAJMIN(a,i))
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c
index 3665b78e488..2e9987eaadb 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.c
@@ -1,7 +1,7 @@
/* mpfr_gmp -- Limited gmp-impl emulator
Modified version of the GMP files.
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 3587b1df767..098fd956f44 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-gmp.h
@@ -1,6 +1,6 @@
/* Uniform Interface to GMP.
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -697,7 +697,7 @@ typedef const mp_limb_t *mpfr_limb_srcptr;
having 16-bit int's, but such implementations are not required to
support bit-fields of size > 16 anyway; if ever an implementation with
16-bit int's is found, the appropriate minimal changes could still be
- done in the future.
+ done in the future. See WG14/N2921 (5.16).
*/
#ifndef _MPFR_IEEE_FLOATS
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 36b58a9fb99..fe54cecab26 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-impl.h
@@ -1,6 +1,6 @@
/* Utilities for MPFR developers, not exported.
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -200,8 +200,10 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
# define MPFR_COLD_FUNCTION_ATTR
#endif
-/* add MPFR_MAYBE_UNUSED after a variable declaration to avoid compiler
- warnings if it is not used */
+/* Add MPFR_MAYBE_UNUSED after a variable declaration to avoid compiler
+ warnings if it is not used.
+ TODO: To be replaced by the future maybe_unused attribute (C2x) once
+ supported. */
#if __MPFR_GNUC(3,4)
#define MPFR_MAYBE_UNUSED __attribute__ ((unused))
#else
@@ -480,7 +482,7 @@ __MPFR_DECLSPEC extern const mpfr_t __gmpfr_const_log2_RNDU;
with GCC's -Wunused-but-set-variable, in non-debug mode).
Note: WG14/N2270 proposed a maybe_unused attribute, which could
be useful to avoid MPFR_DBGRES. See:
- http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2270.pdf
+ https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2270.pdf
Note: Evaluating expr might yield side effects, but such side effects
must not change the results (except by yielding an assertion failure).
*/
@@ -1198,15 +1200,16 @@ typedef uintmax_t mpfr_ueexp_t;
/* We want to test this :
* (rnd == MPFR_RNDU && test) || (rnd == RNDD && !test)
- * ie it transforms RNDU or RNDD to Away or Zero according to the sign */
+ * i.e. it transforms RNDU or RNDD to away or zero according to the sign.
+ * The argument test must be 0 or 1. */
#define MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd, test) \
- (((rnd) + (test)) == MPFR_RNDD)
+ (MPFR_ASSERTD ((test) == 0 || (test) == 1), \
+ ((rnd) + (test)) == MPFR_RNDD)
-/* We want to test if rnd = Zero, or Away.
+/* We want to test if rnd rounds toward zero or away from zero.
'neg' is 1 if negative, and 0 if positive. */
#define MPFR_IS_LIKE_RNDZ(rnd, neg) \
((rnd) == MPFR_RNDZ || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, neg))
-
#define MPFR_IS_LIKE_RNDA(rnd, neg) \
((rnd) == MPFR_RNDA || MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, (neg) == 0))
@@ -1220,7 +1223,7 @@ typedef uintmax_t mpfr_ueexp_t;
((rnd) == MPFR_RNDZ && MPFR_IS_POS_SIGN (sign)) || \
((rnd) == MPFR_RNDA && MPFR_IS_NEG_SIGN (sign)))
-/* Invert a rounding mode, RNDN, RNDZ and RNDA are unchanged */
+/* Invert RNDU and RNDD; the other rounding modes are unchanged. */
#define MPFR_INVERT_RND(rnd) ((rnd) == MPFR_RNDU ? MPFR_RNDD : \
(rnd) == MPFR_RNDD ? MPFR_RNDU : (rnd))
@@ -1231,7 +1234,7 @@ typedef uintmax_t mpfr_ueexp_t;
rnd = MPFR_RNDZ; \
} while (0)
-/* Transform RNDU and RNDD to RNDZ or RNDA according to sign,
+/* Transform RNDU and RNDD to RNDZ or RNDA according to sign;
leave the other modes unchanged.
Usage: MPFR_UPDATE2_RND_MODE (rnd_mode, MPFR_SIGN (x)) */
#define MPFR_UPDATE2_RND_MODE(rnd, sign) \
@@ -1496,19 +1499,8 @@ asm (".section predict_data, \"aw\"; .previous\n"
VAR = VAR trick (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296#c3)
only with gcc as this is undefined behavior, and we don't know what other
compilers do (they may also be smarter). This self-initialization trick
- could be disabled with future gcc versions.
- However, for clang (which defines __GNUC__), this trick must not be used
- as it currently generates a warning, at least with:
- Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0)
- __VERSION__ "4.2.1 Compatible Debian Clang 3.0 (tags/RELEASE_30/final)"
- __clang__ 1
- __clang_major__ 3
- __clang_minor__ 0
- __clang_patchlevel__ 0
- __clang_version__ "3.0 (tags/RELEASE_30/final)"
- (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705583 for this
- problem with clang). */
-#if defined(__GNUC__) && !defined(__clang__)
+ could be disabled with future gcc versions. */
+#if defined(__GNUC__)
# define INITIALIZED(VAR) VAR = VAR
#else
# define INITIALIZED(VAR) VAR
@@ -1624,9 +1616,13 @@ do { \
#define SAFE_ABS(type,x) ((x) >= 0 ? (type)(x) : -(type)(x))
#define SAFE_DIFF(type,x,y) (MPFR_ASSERTD((x) >= (y)), (type)(x) - (type)(y))
+#define ULONG2LONG(U) ((U) > LONG_MAX ? -1 - (long) ~(U) : (long) (U))
+
/* Check whether an integer type (after integer promotion) is signed.
- This can be determined at compilation time, but unfortunately this
- is not a constant expression, so that this cannot be used for a
+ This can be determined at compilation time, but unfortunately,
+ when used in practice, this is not a constant expression (because
+ the argument X is not a constant expression, even though the result
+ does not depend on its value), so that this cannot be used for a
static assertion. */
#define IS_SIGNED(X) ((X) * 0 - 1 < 0)
@@ -1689,6 +1685,14 @@ do { \
in practice since the sizes come from the MPFR source), so that
the value can be used in arbitrary expressions without the risk
of silently switching to unsigned arithmetic. */
+/* TODO: Make numberof() a constant expression and always use it in
+ the MPFR code instead of numberof_const(). See the tricks at
+ https://gcc.gnu.org/pipermail/gcc/2020-September/233763.html
+ "[PATCH v2] <sys/param.h>: Add nitems() and snitems() macros"
+ by Alejandro Colomar
+ but this needs to be fully tested on various platforms and with
+ various compilers and compilation options.
+ Moreover, change "long" to "ptrdiff_t", as used at the above URL? */
#undef numberof
#if 0
/* The following should work with GCC as documented in its manual,
@@ -1711,6 +1715,15 @@ do { \
/* Addition with carry (detected by GCC and other good compilers). */
#define ADD_LIMB(u,v,c) ((u) += (v), (c) = (u) < (v))
+/* umul_hi(h, x, y) puts in h the high part of x*y */
+/* MPFR_NEED_LONGLONG_H needs to be defined to use it. */
+#define umul_hi(h, x, y) \
+ do { \
+ mp_limb_t _l; \
+ umul_ppmm (h, _l, x, y); \
+ (void) _l; /* unused variable */ \
+ } while (0)
+
/******************************************************
************ Save exponent/flags macros ************
@@ -1964,8 +1977,8 @@ typedef struct {
v=1 or v=x.
y is the destination (a mpfr_t), v the value to set (a mpfr_t),
- err1+err2 with err2 <= 3 the error term (mpfr_exp_t's), dir (an int) is
- the direction of the committed error (if dir = 0, it rounds toward 0,
+ err1+err2 with 0 <= err2 <= 3 the error term (mpfr_exp_t's), dir (an int)
+ is the direction of the committed error (if dir = 0, it rounds toward 0,
if dir=1, it rounds away from 0), rnd the rounding mode.
It returns from the function a ternary value in case of success.
@@ -2180,15 +2193,17 @@ __MPFR_DECLSPEC extern mpfr_prec_t mpfr_log_prec;
#define MPFR_LOG_VAR(x) \
LOG_PRINT (MPFR_LOG_INTERNAL_F, "%s.%d:%s[%#Pu]=%.*Rg\n", __func__, \
- __LINE__, #x, mpfr_get_prec (x), mpfr_log_prec, x)
+ (int) __LINE__, #x, mpfr_get_prec (x), mpfr_log_prec, x)
#define MPFR_LOG_MSG2(format, ...) \
- LOG_PRINT (MPFR_LOG_MSG_F, "%s.%d: "format, __func__, __LINE__, __VA_ARGS__)
+ LOG_PRINT (MPFR_LOG_MSG_F, "%s.%d: "format, __func__, (int) __LINE__, \
+ __VA_ARGS__)
#define MPFR_LOG_MSG(x) MPFR_LOG_MSG2 x
#define MPFR_LOG_BEGIN2(format, ...) \
mpfr_log_current ++; \
- LOG_PRINT (MPFR_LOG_INPUT_F, "%s:IN "format"\n", __func__, __VA_ARGS__); \
+ LOG_PRINT (MPFR_LOG_INPUT_F, "%s:IN flags=%x "format"\n", __func__, \
+ (unsigned int) __gmpfr_flags, __VA_ARGS__); \
if ((MPFR_LOG_TIME_F & mpfr_log_type) && \
(mpfr_log_current <= mpfr_log_level)) \
__gmpfr_log_time = mpfr_get_cputime ();
@@ -2199,7 +2214,8 @@ __MPFR_DECLSPEC extern mpfr_prec_t mpfr_log_prec;
#define MPFR_LOG_END2(format, ...) \
LOG_PRINT (MPFR_LOG_TIME_F, "%s:TIM %dms\n", __mpfr_log_fname, \
mpfr_get_cputime () - __gmpfr_log_time); \
- LOG_PRINT (MPFR_LOG_OUTPUT_F, "%s:OUT "format"\n", __mpfr_log_fname, \
+ LOG_PRINT (MPFR_LOG_OUTPUT_F, "%s:OUT flags=%x "format"\n", \
+ __mpfr_log_fname, (unsigned int) __gmpfr_flags, \
__VA_ARGS__); \
mpfr_log_current --;
#define MPFR_LOG_END(x) \
@@ -2492,6 +2508,9 @@ __MPFR_DECLSPEC void mpfr_mpz_clear (mpz_ptr);
__MPFR_DECLSPEC int mpfr_odd_p (mpfr_srcptr);
__MPFR_DECLSPEC int mpfr_nbits_ulong (unsigned long);
+#ifdef _MPFR_H_HAVE_INTMAX_T
+__MPFR_DECLSPEC int mpfr_nbits_uj (uintmax_t);
+#endif
#ifdef _MPFR_H_HAVE_VA_LIST
/* Declared only if <stdarg.h> has been included. */
@@ -2678,6 +2697,21 @@ extern "C" {
(see changeset r13820 in the ubf2 branch). So, for the time being,
as long as the code does not break, do not change anything.
+
+ Note: The condition "use mpfr_ptr to access the usual mpfr_t members and
+ mpfr_ubf_ptr to access the additional member _mpfr_zexp" may be ignored
+ if the union type is visible within the function (see ISO C99 6.5.2.3#5
+ and 6.5.2.3#8 for the example, this implementation being very similar to
+ the valid fragment of this example), which must be the case as the union
+ is declared globally. However, this seems to be buggy in GCC:
+
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14319
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65892
+
+ Alternatively, GCC's may_alias attribute could conditionally be used
+ on the __mpfr_ubf_struct and __mpfr_struct types (though it would be
+ much stronger than needed since only these two types may alias each
+ other).
*/
typedef struct {
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h
index d50f9cb05f7..99f8a197d05 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-intmax.h
@@ -1,6 +1,6 @@
/* MPFR internal header related to intmax_t.
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h
index e1a169406b7..8e71eea79b5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-longlong.h
@@ -1,14 +1,12 @@
/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
-Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2022 Free Software Foundation, Inc.
+Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library and has been copied from
-GNU MP 6.2.0, with the following changes:
+GNU MP 18339:32dc4af70f95, with the following changes:
* the copyright notice (note: only LGPL 3+ is used in MPFR);
* the code declared as added for MPFR just below these comments;
- * __GMP_DECLSPEC renamed to __MPFR_DECLSPEC;
- * patch on https://gmplib.org/list-archives/gmp-bugs/2020-June/004807.html
- for arm / aarch64 / 64-bit powerpc applied.
+ * __GMP_DECLSPEC renamed to __MPFR_DECLSPEC.
The GNU MPFR Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -443,9 +441,17 @@ long __MPN(count_leading_zeros) (UDItype);
#if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \
&& W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \
+ do { \
+ if (__builtin_constant_p (bl) && -(USItype)(bl) < (USItype)(bl)) \
+ __asm__ ("subs\t%1, %4, %5\n\tadc\t%0, %2, %3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "rI" (bh), \
+ "%r" (al), "rI" (-(USItype)(bl)) __CLOBBER_CC); \
+ else \
+ __asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
- : "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
+ : "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC); \
+ } while (0)
/* FIXME: Extend the immediate range for the low word by using both ADDS and
SUBS, since they set carry in the same way. We need separate definitions
for thumb and non-thumb since thumb lacks RSC. */
@@ -461,10 +467,6 @@ long __MPN(count_leading_zeros) (UDItype);
__asm__ ("rsbs\t%1, %5, %4\n\tsbc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "rI" (bh), "rI" (al), "r" (bl) __CLOBBER_CC); \
- else if (__builtin_constant_p (bl)) \
- __asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
- : "=r" (sh), "=&r" (sl) \
- : "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
else \
__asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
@@ -500,11 +502,7 @@ long __MPN(count_leading_zeros) (UDItype);
: "=r" (sh), "=&r" (sl) \
: "rI" (ah), "r" (bh), "rI" (al), "r" (bl) __CLOBBER_CC); \
} \
- else if (__builtin_constant_p (bl)) \
- __asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
- : "=r" (sh), "=&r" (sl) \
- : "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
- else /* only bh might be a constant */ \
+ else \
__asm__ ("subs\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC); \
@@ -560,18 +558,32 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#endif /* __arm__ */
#if defined (__aarch64__) && W_TYPE_SIZE == 64
-/* FIXME: Extend the immediate range for the low word by using both
- ADDS and SUBS, since they set carry in the same way. */
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("adds\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
- : "=r" (sh), "=&r" (sl) \
- : "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \
- "%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) __CLOBBER_CC)
+ do { \
+ if (__builtin_constant_p (bl) && ~(UDItype)(bl) <= (UDItype)(bl)) \
+ __asm__ ("subs\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \
+ "%r" ((UDItype)(al)), "rI" (-(UDItype)(bl)) __CLOBBER_CC);\
+ else \
+ __asm__ ("adds\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
+ : "=r" (sh), "=&r" (sl) \
+ : "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \
+ "%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) __CLOBBER_CC);\
+ } while (0)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \
- : "=r,r" (sh), "=&r,&r" (sl) \
- : "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)), \
- "r,Z" ((UDItype)(al)), "rI,r" ((UDItype)(bl)) __CLOBBER_CC)
+ do { \
+ if (__builtin_constant_p (bl) && ~(UDItype)(bl) <= (UDItype)(bl)) \
+ __asm__ ("adds\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \
+ : "=r,r" (sh), "=&r,&r" (sl) \
+ : "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)), \
+ "r,Z" ((UDItype)(al)), "rI,r" (-(UDItype)(bl)) __CLOBBER_CC);\
+ else \
+ __asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \
+ : "=r,r" (sh), "=&r,&r" (sl) \
+ : "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)), \
+ "r,Z" ((UDItype)(al)), "rI,r" ((UDItype)(bl)) __CLOBBER_CC);\
+ } while(0);
#if __GMP_GNUC_PREREQ (4,9)
#define umul_ppmm(w1, w0, u, v) \
do { \
@@ -854,6 +866,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
: "0" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
"1" ((UDItype)(al)), "r" ((UDItype)(bl)) __CLOBBER_CC); \
} while (0)
+#if !defined (__clang__)
#define umul_ppmm(xh, xl, m0, m1) \
do { \
union {unsigned int __attribute__ ((mode(TI))) __ll; \
@@ -875,6 +888,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
: "0" (__x.__ll), "r" ((UDItype)(d))); \
(q) = __x.__i.__l; (r) = __x.__i.__h; \
} while (0)
+#endif
#if 0 /* FIXME: Enable for z10 (?) */
#define count_leading_zeros(cnt, x) \
do { \
@@ -1040,7 +1054,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
&& (HAVE_HOST_CPU_haswell || HAVE_HOST_CPU_broadwell \
|| HAVE_HOST_CPU_skylake || HAVE_HOST_CPU_bd4 || HAVE_HOST_CPU_zen)
#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mulx\t%3, %0, %1" \
+ __asm__ ("mulx\t%3, %q0, %q1" \
: "=r" (w0), "=r" (w1) \
: "%d" ((UDItype)(u)), "rm" ((UDItype)(v)))
#else
@@ -1148,6 +1162,17 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#endif /* i960mx */
#endif /* i960 */
+
+#if defined (__loongarch64) && W_TYPE_SIZE == 64
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype __u = (u), __v = (v); \
+ (w0) = __u * __v; \
+ (w1) = (unsigned __int128__) __u * __v >> 64; \
+ } while (0)
+#endif
+
+
#if (defined (__mc68000__) || defined (__mc68020__) || defined(mc68020) \
|| defined (__m68k__) || defined (__mc5200__) || defined (__mc5206e__) \
|| defined (__mc5307__)) && W_TYPE_SIZE == 32
@@ -1205,7 +1230,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
" addx%.l %2,%0\n" \
" | End inlined umul_ppmm" \
: "=&d" (xh), "=&d" (xl), \
- "=d" (__umul_tmp1), "=&d" (__umul_tmp2) \
+ "=&d" (__umul_tmp1), "=&d" (__umul_tmp2) \
: "%2" ((USItype)(a)), "d" ((USItype)(b))); \
} while (0)
#endif /* not mc68020 */
@@ -1474,38 +1499,74 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
"%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) \
__CLOBBER_CC); \
} while (0)
+/* We use "*rI" for the constant operand here, since with just "I", gcc barfs.
+ This might seem strange, but gcc folds away the dead code late. */
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
- if (__builtin_constant_p (ah) && (ah) == 0) \
- __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \
- : "=r" (sh), "=&r" (sl) \
- : "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
- __CLOBBER_CC); \
- else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
- __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \
- : "=r" (sh), "=&r" (sl) \
- : "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
- __CLOBBER_CC); \
- else if (__builtin_constant_p (bh) && (bh) == 0) \
- __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \
- : "=r" (sh), "=&r" (sl) \
- : "r" ((UDItype)(ah)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
- __CLOBBER_CC); \
- else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
- __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \
- : "=r" (sh), "=&r" (sl) \
- : "r" ((UDItype)(ah)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
- __CLOBBER_CC); \
- else \
- __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \
- : "=r" (sh), "=&r" (sl) \
- : "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
- "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
- __CLOBBER_CC); \
+ if (__builtin_constant_p (bl) \
+ && (bl) > -0x8000 && (bl) <= 0x8000 && (bl) != 0) { \
+ if (__builtin_constant_p (ah) && (ah) == 0) \
+ __asm__ ("addic %1,%3,%4\n\tsubfze %0,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(bh)), \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ __CLOBBER_CC); \
+ else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
+ __asm__ ("addic %1,%3,%4\n\tsubfme %0,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(bh)), \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ __CLOBBER_CC); \
+ else if (__builtin_constant_p (bh) && (bh) == 0) \
+ __asm__ ("addic %1,%3,%4\n\taddme %0,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(ah)), \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ __CLOBBER_CC); \
+ else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
+ __asm__ ("addic %1,%3,%4\n\taddze %0,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(ah)), \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ __CLOBBER_CC); \
+ else \
+ __asm__ ("addic %1,%4,%5\n\tsubfe %0,%3,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
+ "r" ((UDItype)(al)), "*rI" (-((UDItype)(bl))) \
+ __CLOBBER_CC); \
+ } else { \
+ if (__builtin_constant_p (ah) && (ah) == 0) \
+ __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(bh)), \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
+ else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
+ __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(bh)), \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
+ else if (__builtin_constant_p (bh) && (bh) == 0) \
+ __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(ah)), \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
+ else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
+ __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(ah)), \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
+ else \
+ __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
+ "rI" ((UDItype)(al)), "r" ((UDItype)(bl)) \
+ __CLOBBER_CC); \
+ } \
} while (0)
#endif /* ! _LONG_LONG_LIMB */
#define count_leading_zeros(count, x) \
@@ -1608,12 +1669,12 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
} while (0)
#endif /* RT/ROMP */
-#if defined (__riscv64) && W_TYPE_SIZE == 64
+#if defined (__riscv) && defined (__riscv_mul) && W_TYPE_SIZE == 64
#define umul_ppmm(ph, pl, u, v) \
do { \
UDItype __u = (u), __v = (v); \
(pl) = __u * __v; \
- __asm__ ("mulhu\t%2, %1, %0" : "=r" (ph) : "%r" (__u), "r" (__v)); \
+ __asm__ ("mulhu\t%0, %1, %2" : "=r" (ph) : "%r" (__u), "r" (__v)); \
} while (0)
#endif
@@ -2005,8 +2066,10 @@ extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *)
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
UWtype __x; \
- __x = (al) + (bl); \
- (sh) = (ah) + (bh) + (__x < (al)); \
+ UWtype __al = (al); \
+ UWtype __bl = (bl); \
+ __x = __al + __bl; \
+ (sh) = (ah) + (bh) + (__x < __al); \
(sl) = __x; \
} while (0)
#endif
@@ -2015,8 +2078,10 @@ extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
UWtype __x; \
- __x = (al) - (bl); \
- (sh) = (ah) - (bh) - ((al) < (bl)); \
+ UWtype __al = (al); \
+ UWtype __bl = (bl); \
+ __x = __al - __bl; \
+ (sh) = (ah) - (bh) - (__al < __bl); \
(sl) = __x; \
} while (0)
#endif
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.c b/Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.c
index 2980ffba883..a5d9fa2124c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.c
@@ -1,6 +1,6 @@
/* mpfr-mini-gmp.c -- Interface functions for mini-gmp.
-Copyright 2014-2022 Free Software Foundation, Inc.
+Copyright 2014-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.h
index 9b8cafd0f40..96d1201a79d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-mini-gmp.h
@@ -1,6 +1,6 @@
/* mpfr-mini-gmp.h -- Interface header for mini-gmp.
-Copyright 2014-2022 Free Software Foundation, Inc.
+Copyright 2014-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr-sassert.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr-sassert.h
index ccafa1a1547..f9c9f2293f5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-sassert.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-sassert.h
@@ -1,6 +1,6 @@
/* MPFR internal header related to Static Assertions
-Copyright 2012-2022 Free Software Foundation, Inc.
+Copyright 2012-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 6ae074cf09c..a3099b0d937 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr-thread.h
@@ -1,6 +1,6 @@
/* MPFR internal header related to thread-local variables.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpfr.h b/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
index 74e18577434..4610c67bb17 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpfr.h
@@ -1,6 +1,6 @@
/* mpfr.h -- Include file for mpfr.
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -25,9 +25,9 @@ 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 1
-#define MPFR_VERSION_PATCHLEVEL 1
-#define MPFR_VERSION_STRING "4.1.1"
+#define MPFR_VERSION_MINOR 2
+#define MPFR_VERSION_PATCHLEVEL 0
+#define MPFR_VERSION_STRING "4.2.0"
/* User macros:
MPFR_USE_FILE: Define it to make MPFR define functions dealing
@@ -162,9 +162,6 @@ typedef unsigned short mpfr_uprec_t;
typedef int mpfr_prec_t;
typedef unsigned int mpfr_uprec_t;
#elif _MPFR_PREC_FORMAT == 3
-/* we could use "long long" under Windows 64 here, which can be tested
- with the macro _WIN64 according to
- https://sourceforge.net/p/predef/wiki/OperatingSystems/ */
typedef long mpfr_prec_t;
typedef unsigned long mpfr_uprec_t;
#else
@@ -196,8 +193,19 @@ typedef long mpfr_exp_t;
typedef unsigned long mpfr_uexp_t;
#elif _MPFR_EXP_FORMAT == 4
/* Note: in this case, intmax_t and uintmax_t must be defined before
- the inclusion of mpfr.h (we do not include <stdint.h> here because
- of some non-ISO C99 implementations that support these types). */
+ the inclusion of mpfr.h (we do not include <stdint.h> here due to
+ potential issues with non-ISO implementations, on which there are
+ alternative ways to define these types).
+ In all known implementations, intmax_t has exactly 64 bits and is
+ equivalent to long long when defined, but when long has 64 bits,
+ it may be defined as long by <stdint.h> for better portability
+ with old compilers, thus offers more flexibility than long long.
+ This may change in the future.
+ This _MPFR_EXP_FORMAT value is currently not supported since the
+ MPFR code assumes that mpfr_exp_t fits in a long. Some examples
+ of problematic code can be obtained with:
+ grep -E 'mpfr_cmp_[su]i *\(.*__gmpfr_em' *.c
+*/
typedef intmax_t mpfr_exp_t;
typedef uintmax_t mpfr_uexp_t;
#else
@@ -356,6 +364,10 @@ typedef enum {
not __llvm__, and __declspec(deprecated("...")) can be used with
MSC as above. */
+/* ICC up to 19.1.3.304 at least declares itself as interoperable with
+ GCC 4.9, but does not support the returns_nonnull attribute, thus
+ outputs warning #1292. This minor issue has been reported in 2019-04:
+ https://community.intel.com/t5/Intel-C-Compiler/Missing-support-for-returns-nonnull-attribute/td-p/1183013 */
#if defined(__GNUC__) && \
(__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))
# define MPFR_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
@@ -550,7 +562,9 @@ __MPFR_DECLSPEC int mpfr_snprintf (char*, size_t, const char*, ...);
#endif
__MPFR_DECLSPEC int mpfr_pow (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_powr (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_pow_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_compound_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_pow_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_ui_pow_ui (mpfr_ptr, unsigned long, unsigned long,
@@ -608,12 +622,16 @@ __MPFR_DECLSPEC int mpfr_log (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_log2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_log10 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_log1p (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_log2p1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_log10p1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_log_ui (mpfr_ptr, unsigned long, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_exp (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_exp2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_exp10 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_expm1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_exp2m1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_exp10m1 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_eint (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_li2 (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
@@ -661,6 +679,8 @@ __MPFR_DECLSPEC int mpfr_remquo (mpfr_ptr, long*, mpfr_srcptr, mpfr_srcptr,
__MPFR_DECLSPEC int mpfr_remainder (mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_fmod (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_fmod_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
+ mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_fmodquo (mpfr_ptr, long*, mpfr_srcptr, mpfr_srcptr,
mpfr_rnd_t);
@@ -717,6 +737,22 @@ __MPFR_DECLSPEC int mpfr_sec (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_csc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_cot (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sinu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cosu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_tanu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_acosu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_asinu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_atanu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_atan2u (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_acospi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_asinpi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_atanpi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_atan2pi (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
+
+__MPFR_DECLSPEC int mpfr_sinpi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cospi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_tanpi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+
__MPFR_DECLSPEC int mpfr_hypot (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_erf (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_erfc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
@@ -728,6 +764,7 @@ __MPFR_DECLSPEC int mpfr_root (mpfr_ptr, mpfr_srcptr, unsigned long,
mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_rootn_ui (mpfr_ptr, mpfr_srcptr, unsigned long,
mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_rootn_si (mpfr_ptr, mpfr_srcptr, long, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_gamma (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_gamma_inc (mpfr_ptr, mpfr_srcptr, mpfr_srcptr,
mpfr_rnd_t);
@@ -822,14 +859,14 @@ __MPFR_DECLSPEC int mpfr_total_order_p (mpfr_srcptr, mpfr_srcptr);
(mpfr_round_nearest_away_begin(rop), \
mpfr_round_nearest_away_end((rop), func((rop), __VA_ARGS__, MPFR_RNDN)))
#else
-/* C89 version: function with one input supported */
+/* C90 version: function with one input supported */
#define mpfr_round_nearest_away(func, rop, op) \
(mpfr_round_nearest_away_begin(rop), \
mpfr_round_nearest_away_end((rop), func((rop), (op), MPFR_RNDN)))
#endif
/* Fast access macros to replace function interface.
- If the USER don't want to use the macro interface, let him make happy
+ If the user doesn't want to use the macro interface, let him make happy
even if it produces faster and smaller code. */
#ifndef MPFR_USE_NO_MACRO
@@ -1027,7 +1064,7 @@ __MPFR_DECLSPEC int mpfr_total_order_p (mpfr_srcptr, mpfr_srcptr);
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
#define mpfr_custom_get_kind(x) \
__extension__ ({ \
- mpfr_ptr _x = (x); \
+ mpfr_srcptr _x = (x); \
_x->_mpfr_exp > __MPFR_EXP_INF ? \
(mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (_x) \
: _x->_mpfr_exp == __MPFR_EXP_INF ? \
@@ -1123,6 +1160,8 @@ extern "C" {
#define mpfr_set_uj_2exp __gmpfr_set_uj_2exp
#define mpfr_get_sj __gmpfr_mpfr_get_sj
#define mpfr_get_uj __gmpfr_mpfr_get_uj
+#define mpfr_pow_uj __gmpfr_mpfr_pow_uj
+#define mpfr_pow_sj __gmpfr_mpfr_pow_sj
__MPFR_DECLSPEC int mpfr_set_sj (mpfr_ptr, intmax_t, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_set_sj_2exp (mpfr_ptr, intmax_t, intmax_t,
mpfr_rnd_t);
@@ -1131,6 +1170,13 @@ __MPFR_DECLSPEC int mpfr_set_uj_2exp (mpfr_ptr, uintmax_t, intmax_t,
mpfr_rnd_t);
__MPFR_DECLSPEC intmax_t mpfr_get_sj (mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC uintmax_t mpfr_get_uj (mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_pow_uj (mpfr_ptr, mpfr_srcptr, uintmax_t, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_pow_sj (mpfr_ptr, mpfr_srcptr, intmax_t, mpfr_rnd_t);
+/* define mpfr_pown (defined in IEEE 754-2019) as an alias for mpfr_pow_sj.
+ It is currently implemented as a macro, but this may change in the future
+ (it could be implemented as an inline function); in case of change, update
+ the manual. */
+#define mpfr_pown mpfr_pow_sj
#if defined (__cplusplus)
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c b/Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c
index c779ec95d65..7318953ab94 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mpn_exp.c
@@ -1,6 +1,6 @@
/* mpfr_mpn_exp -- auxiliary function for mpfr_get_str and mpfr_set_str
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul.c b/Build/source/libs/mpfr/mpfr-src/src/mul.c
index 3542b64e3cd..6f319040b03 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul.c
@@ -1,6 +1,6 @@
/* mpfr_mul -- multiply two floating-point numbers
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_1_extracted.c b/Build/source/libs/mpfr/mpfr-src/src/mul_1_extracted.c
index 2981921d2da..814eae4f644 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_1_extracted.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_1_extracted.c
@@ -4,7 +4,7 @@
Source: https://github.com/project-everest/hacl-star/tree/dev_mpfr/code/mpfr
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c b/Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c
index 266f20e2a86..7e687956ae0 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_2exp.c
@@ -1,6 +1,6 @@
/* mpfr_mul_2exp -- multiply a floating-point number by a power of two
-Copyright 1999, 2001, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 2a226c56c65..7d0038c74a3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_2si.c
@@ -1,6 +1,6 @@
/* mpfr_mul_2si -- multiply a floating-point number by a power of two
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 b4a0f5d1816..b76f8579708 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_2ui.c
@@ -1,6 +1,6 @@
/* mpfr_mul_2ui -- multiply a floating-point number by a power of two
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 fbcedcfab14..e0fe1e7e981 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_d.c
@@ -1,7 +1,7 @@
/* mpfr_mul_d -- multiply a multiple precision floating-point number
by a machine double precision float
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mul_ui.c b/Build/source/libs/mpfr/mpfr-src/src/mul_ui.c
index 18551bf5b31..1891fa83033 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mul_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mul_ui.c
@@ -1,6 +1,6 @@
/* mpfr_mul_ui -- multiply a floating-point number by a machine integer
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mulders.c b/Build/source/libs/mpfr/mpfr-src/src/mulders.c
index 8e178200e19..99866907615 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/mulders.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/mulders.c
@@ -1,6 +1,6 @@
/* Mulders' short product, square and division.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/nbits_ulong.c b/Build/source/libs/mpfr/mpfr-src/src/nbits_ulong.c
index c828e15094c..7b098d2fc26 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/nbits_ulong.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/nbits_ulong.c
@@ -1,6 +1,7 @@
/* mpfr_nbits_ulong -- number of significant bits in an unsigned long
+ mpfr_nbits_uj -- number of significant bits in an uintmax_t
-Copyright 2018-2022 Free Software Foundation, Inc.
+Copyright 2018-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -21,6 +22,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#define MPFR_NEED_LONGLONG_H /* for count_leading_zeros */
+#define MPFR_NEED_INTMAX_H
#include "mpfr-impl.h"
/* count the number of significant bits of n, i.e.,
@@ -81,3 +83,55 @@ mpfr_nbits_ulong (unsigned long n)
MPFR_ASSERTD (cnt >= 0);
return cnt;
}
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+/* count the number of significant bits of n, i.e.,
+ nbits(uintmax_t) - count_leading_zeros (n) */
+int
+mpfr_nbits_uj (uintmax_t n)
+{
+ int cnt;
+
+ MPFR_ASSERTD (n > 0);
+
+ cnt = 0;
+
+ while (n >= 0x10000)
+ {
+ n >>= 16;
+ cnt += 16;
+ }
+
+ MPFR_ASSERTD (n <= 0xffff);
+
+ if (n >= 0x100)
+ {
+ n >>= 8;
+ cnt += 8;
+ }
+
+ MPFR_ASSERTD (n <= 0xff);
+
+ if (n >= 0x10)
+ {
+ n >>= 4;
+ cnt += 4;
+ }
+
+ MPFR_ASSERTD (n <= 0xf);
+
+ if (n >= 4)
+ {
+ n >>= 2;
+ cnt += 2;
+ }
+
+ MPFR_ASSERTD (n <= 3);
+
+ /* now n = 1, 2, or 3 */
+ cnt += 1 + (n >= 2);
+
+ MPFR_ASSERTD (cnt >= 0);
+ return cnt;
+}
+#endif
diff --git a/Build/source/libs/mpfr/mpfr-src/src/neg.c b/Build/source/libs/mpfr/mpfr-src/src/neg.c
index c872952e7fc..28fa150ef30 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/neg.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/neg.c
@@ -1,6 +1,6 @@
/* mpfr_neg -- change the sign of a floating-point number
-Copyright 1999-2001, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999-2001, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/next.c b/Build/source/libs/mpfr/mpfr-src/src/next.c
index f6a568c43dd..1a3bd0efd75 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/next.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/next.c
@@ -1,7 +1,7 @@
/* mpfr_nextabove, mpfr_nextbelow, mpfr_nexttoward -- next representable
floating-point number
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -23,8 +23,22 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* Note concerning the exceptions: In case of NaN result, the NaN flag is
* set as usual. No underflow or overflow is generated (this contradicts
- * the obsolete IEEE 754-1985 standard for Nextafter, but conforms to the
- * current standard IEEE 754-2008 for nextUp and nextDown).
+ * the obsolete IEEE 754-1985 standard for nextafter, but conforms to the
+ * IEEE 754-2008/2019 standards, where the nextUp and nextDown operations
+ * replaced nextafter).
+ *
+ * For mpfr_nexttoward where x and y are zeros of different signs, the
+ * behavior is the same as the nextafter function from IEEE 754-1985
+ * (x is returned), but differs from the ISO C99 nextafter and nexttoward
+ * functions (where y is returned).
+ *
+ * In short:
+ * - mpfr_nextabove and mpfr_nextbelow are similar to nextUp and nextDown
+ * respectively (IEEE 2008+, ISO C2x), but with the usual MPFR rule for
+ * the NaN flag (because MPFR has a single kind of NaN);
+ * - mpfr_nexttoward is also similar to these functions concerning the
+ * exceptions and the sign of 0, and for the particular case x = y, it
+ * follows the old nextafter function from IEEE 754-1985.
*/
#include "mpfr-impl.h"
diff --git a/Build/source/libs/mpfr/mpfr-src/src/nrandom.c b/Build/source/libs/mpfr/mpfr-src/src/nrandom.c
index 7742cce0f49..b5ac1167179 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/nrandom.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/nrandom.c
@@ -2,7 +2,7 @@
and variance 1 and round it to the precision of rop according to the given
rounding mode.
-Copyright 2013-2022 Free Software Foundation, Inc.
+Copyright 2013-2023 Free Software Foundation, Inc.
Contributed by Charles Karney <charles@karney.com>, SRI International.
This file is part of the GNU MPFR Library.
@@ -31,6 +31,11 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
* https://dx.doi.org/10.1145/2710016
* https://arxiv.org/abs/1303.6257
*
+ * Note: the algorithm implemented here has been improved in
+ * Du, Fan and Wei in "An improved exact sampling algorithm for the standard
+ * normal distribution", Computational Statistics, 2021,
+ * https://doi.org/10.1007/s00180-021-01136-w
+ *
* The implementation here closely follows the C++ one given in the paper
* above. However, here, C is simplified by using gmp_urandomm_ui; the initial
* rejection step in H just tests the leading bit of p; and the assignment of
diff --git a/Build/source/libs/mpfr/mpfr-src/src/odd_p.c b/Build/source/libs/mpfr/mpfr-src/src/odd_p.c
index 333e913b2e3..47374a01cf8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/odd_p.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/odd_p.c
@@ -1,6 +1,6 @@
/* mpfr_odd_p -- check for odd integers
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/out_str.c b/Build/source/libs/mpfr/mpfr-src/src/out_str.c
index 2ac2f3c1192..8a17203d228 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/out_str.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/out_str.c
@@ -1,6 +1,6 @@
/* mpfr_out_str -- output a floating-point number to a stream
-Copyright 1999, 2001-2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/pool.c b/Build/source/libs/mpfr/mpfr-src/src/pool.c
index b58b9d4bb85..7e5aeaf045d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pool.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pool.c
@@ -1,6 +1,6 @@
/* mpz_t pool
-Copyright 2014-2022 Free Software Foundation, Inc.
+Copyright 2014-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow.c b/Build/source/libs/mpfr/mpfr-src/src/pow.c
index b752ac81749..a7ba3ee1ff3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pow.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow.c
@@ -1,6 +1,6 @@
/* mpfr_pow -- power function x^y
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 871d1957738..22cda32e129 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pow_si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow_si.c
@@ -1,6 +1,6 @@
/* mpfr_pow_si -- power function x^y with y a signed int
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -23,21 +23,32 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define MPFR_NEED_LONGLONG_H /* for MPFR_INT_CEIL_LOG2 */
#include "mpfr-impl.h"
-/* The computation of y = pow_si(x,n) is done by
- * y = pow_ui(x,n) if n >= 0
- * y = 1 / pow_ui(x,-n) if n < 0
+/* The computation of y = pow_si/sj(x,n) is done by
+ * y = pow_ui/uj(x,n) if n >= 0
+ * y = 1 / pow_ui/uj(x,-n) if n < 0
*/
+#ifndef POW_S
+#define POW_S mpfr_pow_si
+#define POW_U mpfr_pow_ui
+#define SET_S mpfr_set_si
+#define SET_S_2EXP mpfr_set_si_2exp
+#define NBITS_UTYPE mpfr_nbits_ulong
+#define TYPE long int
+#define UTYPE unsigned long
+#define FSPEC "l"
+#endif
+
int
-mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd)
+POW_S (mpfr_ptr y, mpfr_srcptr x, TYPE n, mpfr_rnd_t rnd)
{
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg n=%ld rnd=%d",
+ (("x[%Pu]=%.*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));
if (n >= 0)
- return mpfr_pow_ui (y, x, n, rnd);
+ return POW_U (y, x, n, rnd);
else
{
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
@@ -49,7 +60,7 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd)
}
else
{
- int positive = MPFR_IS_POS (x) || ((unsigned long) n & 1) == 0;
+ int positive = MPFR_IS_POS (x) || ((UTYPE) n & 1) == 0;
if (MPFR_IS_INF (x))
MPFR_SET_ZERO (y);
else /* x is zero */
@@ -130,8 +141,7 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd)
MPFR_EMIN_MIN - 2 /* Underflow */ :
n != -1 && expx < 0 && expx < (__gmpfr_emax - 1) / n ?
MPFR_EMAX_MAX /* Overflow */ : n * expx;
- return mpfr_set_si_2exp (y, n % 2 ? MPFR_INT_SIGN (x) : 1,
- expy, rnd);
+ return SET_S_2EXP (y, n % 2 ? MPFR_INT_SIGN (x) : 1, expy, rnd);
}
/* General case */
@@ -144,12 +154,12 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd)
mpfr_rnd_t rnd1;
int size_n;
int inexact;
- unsigned long abs_n;
+ UTYPE abs_n;
MPFR_SAVE_EXPO_DECL (expo);
MPFR_ZIV_DECL (loop);
- abs_n = - (unsigned long) n;
- size_n = mpfr_nbits_ulong (abs_n);
+ abs_n = - (UTYPE) n;
+ size_n = NBITS_UTYPE (abs_n);
/* initial working precision */
Ny = MPFR_PREC (y);
@@ -166,18 +176,38 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd)
rnd1 = MPFR_EXP (x) < 1 ? MPFR_RNDZ :
(MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD);
+ /* The following ensures that 1/x cannot underflow.
+ Since |x| < 2^emax, |1/x| > 2^(-emax) >= 2^emin. */
+ MPFR_STAT_STATIC_ASSERT (MPFR_EMIN_MIN + MPFR_EMAX_MAX <= 0);
+
MPFR_ZIV_INIT (loop, Nt);
for (;;)
{
MPFR_BLOCK_DECL (flags);
+ /* TODO: Compute POW_U before the division (instead of after)
+ in order to reduce the error in the intermediate result?
+ POW_U, whose condition number is |n|, which may be large,
+ would be called on an exact value. This may be important
+ in very small precisions.
+ In this case, if x^|n| underflows, then |x^n| > 2^emax
+ (real overflow, and we can return the result); and if
+ x^|n| overflows, then the result underflows or is very
+ close to the underflow threshold, so that we should use
+ mpfr_pow_general (as already done for MPFR_RNDN), which
+ can handle such a case.
+ So the advantage of computing POW_U before the division
+ is that the code would be slightly faster is the general
+ case, but it could be noticeably slower in very uncommon
+ cases (and only with the extended exponent range). */
+
/* compute (1/x)^|n| */
MPFR_BLOCK (flags, mpfr_ui_div (t, 1, x, rnd1));
MPFR_ASSERTD (! MPFR_UNDERFLOW (flags));
/* t = (1/x)*(1+theta) where |theta| <= 2^(-Nt) */
if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
goto overflow;
- MPFR_BLOCK (flags, mpfr_pow_ui (t, t, abs_n, rnd));
+ MPFR_BLOCK (flags, POW_U (t, t, abs_n, rnd));
/* t = (1/x)^|n|*(1+theta')^(|n|+1) where |theta'| <= 2^(-Nt).
If (|n|+1)*2^(-Nt) <= 1/2, which is satisfied as soon as
Nt >= bits(n)+2, then we can use Lemma \ref{lemma_graillat}
@@ -210,8 +240,8 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd)
MPFR_ASSERTD (mpfr_cmp_si_2exp (x, MPFR_SIGN (x),
MPFR_EXP (x) - 1) != 0);
mpfr_init2 (y2, 2);
- mpfr_init2 (nn, sizeof (long) * CHAR_BIT);
- inexact = mpfr_set_si (nn, n, MPFR_RNDN);
+ mpfr_init2 (nn, sizeof (TYPE) * CHAR_BIT);
+ inexact = SET_S (nn, n, MPFR_RNDN);
MPFR_ASSERTN (inexact == 0);
inexact = mpfr_pow_general (y2, x, nn, rnd, 1,
(mpfr_save_expo_t *) NULL);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow_sj.c b/Build/source/libs/mpfr/mpfr-src/src/pow_sj.c
new file mode 100644
index 00000000000..bd3db30a6ed
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow_sj.c
@@ -0,0 +1,40 @@
+/* mpfr_pow_sj -- power function x^y with y an intmax_t
+
+Copyright 2021-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#define MPFR_NEED_INTMAX_H
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+
+#define POW_S mpfr_pow_sj
+#define POW_U mpfr_pow_uj
+#define SET_S mpfr_set_sj
+#define SET_S_2EXP mpfr_set_sj_2exp
+#define NBITS_UTYPE mpfr_nbits_uj
+#define TYPE intmax_t
+#define UTYPE uintmax_t
+#define FSPEC "j"
+
+#include "pow_si.c"
+
+#endif
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 216d1389a96..b59399135c1 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow_ui.c
@@ -1,7 +1,6 @@
-/* mpfr_pow_ui-- compute the power of a floating-point
- by a machine integer
+/* mpfr_pow_ui -- compute the power of a floating-point by a machine integer
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -24,13 +23,20 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
+#ifndef POW_U
+#define POW_U mpfr_pow_ui
+#define MPZ_SET_U mpz_set_ui
+#define UTYPE unsigned long int
+#define FSPEC "l"
+#endif
+
/* sets y to x^n, and return 0 if exact, non-zero otherwise */
int
-mpfr_pow_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd)
+POW_U (mpfr_ptr y, mpfr_srcptr x, UTYPE n, mpfr_rnd_t rnd)
{
- unsigned long m;
+ UTYPE m;
mpfr_t res;
- mpfr_prec_t prec, err;
+ mpfr_prec_t prec, err, nlen;
int inexact;
mpfr_rnd_t rnd1;
MPFR_SAVE_EXPO_DECL (expo);
@@ -38,7 +44,7 @@ mpfr_pow_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd)
MPFR_BLOCK_DECL (flags);
MPFR_LOG_FUNC
- (("x[%Pu]=%.*Rg n=%lu rnd=%d",
+ (("x[%Pu]=%.*Rg n=%" FSPEC "u rnd=%d",
mpfr_get_prec (x), mpfr_log_prec, x, n, rnd),
("y[%Pu]=%.*Rg inexact=%d",
mpfr_get_prec (y), mpfr_log_prec, y, inexact));
@@ -89,9 +95,15 @@ mpfr_pow_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd)
/* Augment exponent range */
MPFR_SAVE_EXPO_MARK (expo);
+ for (m = n, nlen = 0; m != 0; nlen++, m >>= 1)
+ ;
+ /* 2^(nlen-1) <= n < 2^nlen */
+
/* set up initial precision */
prec = MPFR_PREC (y) + 3 + GMP_NUMB_BITS
+ MPFR_INT_CEIL_LOG2 (MPFR_PREC (y));
+ if (prec <= nlen)
+ prec = nlen + 1;
mpfr_init2 (res, prec);
rnd1 = MPFR_IS_POS (x) ? MPFR_RNDU : MPFR_RNDD; /* away */
@@ -101,21 +113,19 @@ mpfr_pow_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd)
{
int i;
- for (m = n, i = 0; m; i++, m >>= 1)
- ;
- /* now 2^(i-1) <= n < 2^i */
- MPFR_ASSERTD (prec > (mpfr_prec_t) i);
- err = prec - 1 - (mpfr_prec_t) i;
+ MPFR_ASSERTD (prec > nlen);
+ err = prec - 1 - nlen;
/* First step: compute square from x */
MPFR_BLOCK (flags,
inexact = mpfr_sqr (res, x, MPFR_RNDU);
- MPFR_ASSERTD (i >= 2);
- if (n & (1UL << (i-2)))
+ MPFR_ASSERTD (nlen >= 2 && nlen <= INT_MAX);
+ i = nlen;
+ if (n & ((UTYPE) 1 << (i-2)))
inexact |= mpfr_mul (res, res, x, rnd1);
for (i -= 3; i >= 0 && !MPFR_BLOCK_EXCEP; i--)
{
inexact |= mpfr_sqr (res, res, MPFR_RNDU);
- if (n & (1UL << i))
+ if (n & ((UTYPE) 1 << i))
inexact |= mpfr_mul (res, res, x, rnd1);
});
/* let r(n) be the number of roundings: we have r(2)=1, r(3)=2,
@@ -150,7 +160,7 @@ mpfr_pow_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mpfr_rnd_t rnd)
mpfr_clear (res);
MPFR_SAVE_EXPO_FREE (expo);
mpz_init (z);
- mpz_set_ui (z, n);
+ MPZ_SET_U (z, n);
inexact = mpfr_pow_z (y, x, z, rnd);
mpz_clear (z);
return inexact;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/pow_uj.c b/Build/source/libs/mpfr/mpfr-src/src/pow_uj.c
new file mode 100644
index 00000000000..b23abeb5b0b
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow_uj.c
@@ -0,0 +1,62 @@
+/* mpfr_pow_uj -- compute the power of a floating-point by a uintmax_t
+
+Copyright 2021-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#define MPFR_NEED_INTMAX_H
+#include "mpfr-impl.h"
+
+#ifdef _MPFR_H_HAVE_INTMAX_T
+
+#define POW_U mpfr_pow_uj
+#define MPZ_SET_U mpfr_mpz_set_uj
+#define UTYPE uintmax_t
+#define FSPEC "j"
+
+#define ULONG_BITS (sizeof (unsigned long) * CHAR_BIT)
+
+/* z <- n, assuming uintmax_t is at most twice as wide as unsigned long
+ and assume no padding bits.
+ FIXME: code should be shared with mpfr_set_uj_2exp to avoid such
+ limitations (and this could be more efficient).
+*/
+static void
+mpfr_mpz_set_uj (mpz_t z, uintmax_t n)
+{
+ if ((unsigned long) n == n)
+ mpz_set_ui (z, n);
+ else
+ {
+ uintmax_t h = (n >> (ULONG_BITS - 1)) >> 1;
+ /* equivalent to n >> ULONG_BITS, as a workaround to GCC bug 4210
+ "should not warn in dead code". */
+
+ MPFR_ASSERTN ((unsigned long) h == h);
+
+ mpz_set_ui (z, (unsigned long) h);
+ mpz_mul_2exp (z, z, ULONG_BITS);
+ mpz_add_ui (z, z, (unsigned long) n);
+ }
+}
+
+#include "pow_ui.c"
+
+#endif
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 1698f551d07..2388ed081df 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/pow_z.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/pow_z.c
@@ -1,6 +1,6 @@
/* mpfr_pow_z -- power function x^z with z a MPZ
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/powerof2.c b/Build/source/libs/mpfr/mpfr-src/src/powerof2.c
index dc416d91093..29870c2a725 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/powerof2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/powerof2.c
@@ -1,6 +1,6 @@
/* mpfr_powerof2_raw -- test whether a floating-point number is a power of 2
-Copyright 2002-2022 Free Software Foundation, Inc.
+Copyright 2002-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h
index f9d6fec49dd..a149bed134b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/powerpc64/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/powr.c b/Build/source/libs/mpfr/mpfr-src/src/powr.c
new file mode 100644
index 00000000000..61a100f1bb7
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/powr.c
@@ -0,0 +1,60 @@
+/* mpfr_powr -- powr(x,y) = exp(y*log(x))
+
+Copyright 2021-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+int
+mpfr_powr (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
+{
+ /* powr(x,y) is NaN for x=NaN or x < 0 (a)
+ powr(+/-0,+/-0) is NaN whereas pow(x,+/-0) = 1 if x is not NaN (b)
+ powr(+Inf,+/-0) is NaN whereas pow(x,+/-0) = 1 if x is not NaN (b)
+ We can use MPFR_IS_SINGULAR since we already excluded x=NaN and x=-Inf.
+ powr(1,+/-Inf) = NaN whereas pow(1,+/-Inf) = 1 (c) */
+ if (MPFR_IS_NAN (x) || MPFR_IS_STRICTNEG(x) || /* case (a) */
+ (MPFR_IS_SINGULAR(x) && MPFR_IS_ZERO(y)) || /* case (b) */
+ (mpfr_cmp_ui (x, 1) == 0 && MPFR_IS_INF(y))) /* case (c) */
+ {
+ MPFR_SET_NAN (z);
+ MPFR_RET_NAN;
+ }
+ /* for finite y < 0, powr(-0,y) is +Inf, whereas pow(-0,y) is -Inf for y an
+ odd negativeinteger, and +Inf otherwise */
+ if (MPFR_IS_ZERO(x) && MPFR_SIGN(x) < 0 && !MPFR_IS_SINGULAR (y)
+ && MPFR_IS_NEG(y))
+ {
+ MPFR_SET_INF (z);
+ MPFR_SET_POS (z);
+ MPFR_SET_DIVBY0 ();
+ MPFR_RET (0);
+ }
+ /* for y > 0, powr(-0,y) is +0, whereas pow gives -0 for y an odd integer */
+ if (MPFR_IS_ZERO(x) && MPFR_SIGN(x) < 0 && !MPFR_IS_SINGULAR (y)
+ && MPFR_IS_POS(y))
+ {
+ MPFR_SET_ZERO (z);
+ MPFR_SET_POS (z);
+ MPFR_RET (0);
+ }
+ /* otherwise powr coincides with pow */
+ return mpfr_pow (z, x, y, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/print_raw.c b/Build/source/libs/mpfr/mpfr-src/src/print_raw.c
index 1d41284c42a..10b3ee8094e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/print_raw.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/print_raw.c
@@ -2,7 +2,7 @@
of a significand of floating-point number (for the tests and
debugging purpose)
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c b/Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c
index 9e4c601dd39..dad042b040d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/print_rnd_mode.c
@@ -1,6 +1,6 @@
/* mpfr_print_rnd_mode -- convert a given rounding mode to a string
-Copyright 1999, 2001-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/printf.c b/Build/source/libs/mpfr/mpfr-src/src/printf.c
index a9776ab2927..a07e741c005 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/printf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/printf.c
@@ -1,6 +1,6 @@
/* Formatted output functions (printf functions family).
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/random_deviate.c b/Build/source/libs/mpfr/mpfr-src/src/random_deviate.c
index 2161affb0d9..e3d886d86dc 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/random_deviate.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/random_deviate.c
@@ -1,6 +1,6 @@
/* random_deviate routines for mpfr_erandom and mpfr_nrandom.
-Copyright 2013-2022 Free Software Foundation, Inc.
+Copyright 2013-2023 Free Software Foundation, Inc.
Contributed by Charles Karney <charles@karney.com>, SRI International.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/random_deviate.h b/Build/source/libs/mpfr/mpfr-src/src/random_deviate.h
index f8cde647160..c13fc79a750 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/random_deviate.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/random_deviate.h
@@ -1,6 +1,6 @@
/* Declarations of random_deviate routines for mpfr_erandom and mpfr_nrandom.
-Copyright 2013-2022 Free Software Foundation, Inc.
+Copyright 2013-2023 Free Software Foundation, Inc.
Contributed by Charles Karney <charles@karney.com>, SRI International.
This file is part of the GNU MPFR Library.
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 a192e69c719..c6ca40ba107 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/rec_sqrt.c
@@ -1,6 +1,6 @@
/* mpfr_rec_sqrt -- inverse square root
-Copyright 2008-2022 Free Software Foundation, Inc.
+Copyright 2008-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -274,7 +274,7 @@ mpfr_mpn_rec_sqrt (mpfr_limb_ptr x, mpfr_prec_t p,
umul_ppmm(r[1], r[0], x[ln], x[ln]);
else
{
- mpn_mul_n (r, x + ln, x + ln, xn);
+ mpn_sqr (r, x + ln, xn);
/* we have {r, 2*xn} = X_h^2 */
if (rn < 2 * xn)
r ++;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/reldiff.c b/Build/source/libs/mpfr/mpfr-src/src/reldiff.c
index bfa78b8e0fc..832bf4d2b5e 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/reldiff.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/reldiff.c
@@ -1,6 +1,6 @@
/* mpfr_reldiff -- compute relative difference of two floating-point numbers.
-Copyright 2000-2001, 2004-2022 Free Software Foundation, Inc.
+Copyright 2000-2001, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/rem1.c b/Build/source/libs/mpfr/mpfr-src/src/rem1.c
index ada46642f78..f4732b78cb1 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/rem1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/rem1.c
@@ -2,7 +2,7 @@
mpfr_fmod -- compute the floating-point remainder of x/y
mpfr_remquo and mpfr_remainder -- argument reduction functions
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -40,10 +40,10 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
If rem is zero, then it has the sign of x.
The returned 'int' is the inexact flag giving the place of rem wrt x - q*y.
- If x or y is NaN: *quo is undefined, rem is NaN.
- If x is Inf, whatever y: *quo is undefined, rem is NaN.
+ If x or y is NaN: *quo is unspecified, rem is NaN.
+ If x is Inf, whatever y: *quo is unspecified, rem is NaN.
If y is Inf, x not NaN nor Inf: *quo is 0, rem is x.
- If y is 0, whatever x: *quo is undefined, rem is NaN.
+ If y is 0, whatever x: *quo is unspecified, rem is NaN.
If x is 0, whatever y (not NaN nor 0): *quo is 0, rem is x.
Otherwise if x and y are neither NaN, Inf nor 0, q is always defined,
@@ -68,7 +68,7 @@ mpfr_rem1 (mpfr_ptr rem, long *quo, mpfr_rnd_t rnd_q,
if (MPFR_IS_NAN (x) || MPFR_IS_NAN (y) || MPFR_IS_INF (x)
|| MPFR_IS_ZERO (y))
{
- /* for remquo, quo is undefined */
+ /* for remquo, *quo is unspecified */
MPFR_SET_NAN (rem);
MPFR_RET_NAN;
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/rint.c b/Build/source/libs/mpfr/mpfr-src/src/rint.c
index 4d222208f24..d9be629c8d8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/rint.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/rint.c
@@ -1,6 +1,6 @@
/* mpfr_rint -- Round to an integer.
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/rndna.c b/Build/source/libs/mpfr/mpfr-src/src/rndna.c
index 5a76c88c0bc..e53d102b606 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/rndna.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/rndna.c
@@ -1,6 +1,6 @@
/* mpfr_round_nearest_away -- round to nearest away
-Copyright 2012-2022 Free Software Foundation, Inc.
+Copyright 2012-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/root.c b/Build/source/libs/mpfr/mpfr-src/src/root.c
index 6744ba940fd..386846ad2c6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/root.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/root.c
@@ -1,6 +1,6 @@
-/* mpfr_root -- kth root.
+/* mpfr_root, mpfr_rootn_ui, mpfr_rootn_si -- kth root.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -299,6 +299,145 @@ mpfr_root_aux (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode)
}
int
+mpfr_rootn_si (mpfr_ptr y, mpfr_srcptr x, long k, mpfr_rnd_t rnd_mode)
+{
+ int inexact;
+ MPFR_ZIV_DECL(loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC
+ (("x[%Pu]=%.*Rg k=%lu rnd=%d",
+ mpfr_get_prec (x), mpfr_log_prec, x, k, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec (y), mpfr_log_prec, y, inexact));
+
+ if (k >= 0)
+ return mpfr_rootn_ui (y, x, k, rnd_mode);
+
+ /* Singular values for k < 0 */
+ if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ if (MPFR_IS_NAN (x))
+ {
+ MPFR_SET_NAN (y); /* NaN^(1/k) = NaN */
+ MPFR_RET_NAN;
+ }
+
+ if (MPFR_IS_INF (x)) /* (+Inf)^(1/k) = +0
+ (-Inf)^(1/k) = -0 if k odd
+ (-Inf)^(1/k) = NaN if k even */
+ {
+ /* Cast k to an unsigned type so that this is well-defined. */
+ if (MPFR_IS_NEG (x) && ((unsigned long) k & 1) == 0)
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ }
+ else /* x is necessarily 0: (+0)^(1/k) = +Inf
+ (-0)^(1/k) = +Inf if k even
+ (-0)^(1/k) = -Inf if k odd */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_INF (y);
+ /* Cast k to an unsigned type so that this is well-defined. */
+ if (MPFR_IS_POS (x) || ((unsigned long) k & 1) == 0)
+ MPFR_SET_POS (y);
+ else
+ MPFR_SET_NEG (y);
+ MPFR_SET_DIVBY0 ();
+ }
+ MPFR_RET (0);
+ }
+
+ /* Returns NAN for x < 0 and k even */
+ /* Cast k to an unsigned type so that this is well-defined. */
+ if (MPFR_UNLIKELY (MPFR_IS_NEG (x) && ((unsigned long) k & 1) == 0))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+
+ /* Special case |x| = 1. Note that if x = -1, then k is odd
+ (NaN results have already been filtered), so that y = -1. */
+ if (mpfr_cmpabs (x, __gmpfr_one) == 0)
+ return mpfr_set (y, x, rnd_mode);
+
+ /* The case k = -1 is probably rare in practice (the user would directly
+ do a division if k is a constant, and even mpfr_pow_si is more natural).
+ But let's take it into account here, so that in the general case below,
+ overflows and underflows will be impossible, and we won't need to test
+ and handle the corresponding flags. And let's take the opportunity to
+ handle k = -2 as well since mpfr_rec_sqrt is faster than the generic
+ mpfr_rootn_si (this is visible when running the trec_sqrt tests with
+ mpfr_rootn_si + generic code for k = -2 instead of mpfr_rec_sqrt). */
+ /* TODO: If MPFR_WANT_ASSERT >= 2, define a new mpfr_rootn_si function
+ so that for k = -2, compute the result with both mpfr_rec_sqrt and
+ the generic code, and compare (ditto for mpfr_rec_sqrt), like what
+ is done in add1sp.c (mpfr_add1sp and mpfr_add1 results compared). */
+ if (k >= -2)
+ {
+ if (k == -1)
+ return mpfr_ui_div (y, 1, x, rnd_mode);
+ else
+ return mpfr_rec_sqrt (y, x, rnd_mode);
+ }
+
+ /* TODO: Should we expand mpfr_root_aux to negative values of k
+ and call it if k < -100, a bit like in mpfr_rootn_ui? */
+
+ /* General case */
+ {
+ mpfr_t t;
+ mpfr_prec_t Ny; /* target precision */
+ mpfr_prec_t Nt; /* working precision */
+
+ /* initial working precision */
+ Ny = MPFR_PREC (y);
+ Nt = Ny + 10;
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ mpfr_init2 (t, Nt);
+
+ MPFR_ZIV_INIT (loop, Nt);
+ for (;;)
+ {
+ /* Compute the root before the division, in particular to avoid
+ overflows and underflows.
+ Moreover, midpoints are impossible. And an exact case implies
+ that |x| is a power of 2; such a case is not the most common
+ one, so that we detect it only after MPFR_CAN_ROUND. */
+
+ /* Let's use MPFR_RNDF to avoid the potentially costly detection
+ of exact cases in mpfr_rootn_ui (we just lose one bit in the
+ final approximation). */
+ mpfr_rootn_ui (t, x, - (unsigned long) k, MPFR_RNDF);
+ inexact = mpfr_ui_div (t, 1, t, rnd_mode);
+
+ /* The final error is bounded by 5 ulp (see algorithms.tex,
+ "Generic error of inverse"), which is <= 2^3 ulp. */
+ MPFR_ASSERTD (! MPFR_IS_SINGULAR (t));
+ if (MPFR_LIKELY (MPFR_CAN_ROUND (t, Nt - 3, Ny, rnd_mode) ||
+ (inexact == 0 && mpfr_powerof2_raw (x))))
+ break;
+
+ MPFR_ZIV_NEXT (loop, Nt);
+ mpfr_set_prec (t, Nt);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, t, rnd_mode);
+ mpfr_clear (t);
+
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
+ }
+}
+
+int
mpfr_root (mpfr_ptr y, mpfr_srcptr x, unsigned long k, mpfr_rnd_t rnd_mode)
{
MPFR_LOG_FUNC
diff --git a/Build/source/libs/mpfr/mpfr-src/src/round_near_x.c b/Build/source/libs/mpfr/mpfr-src/src/round_near_x.c
index 3d5bb90f3a1..e6ecf78335d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/round_near_x.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/round_near_x.c
@@ -1,6 +1,6 @@
/* mpfr_round_near_x -- Round a floating point number nears another one.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/round_p.c b/Build/source/libs/mpfr/mpfr-src/src/round_p.c
index 0c208285abb..d402e765314 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/round_p.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/round_p.c
@@ -1,6 +1,6 @@
/* mpfr_round_p -- check if an approximation is roundable.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/round_prec.c b/Build/source/libs/mpfr/mpfr-src/src/round_prec.c
index a298102c163..1d525569a66 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/round_prec.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/round_prec.c
@@ -1,7 +1,7 @@
/* mpfr_round_raw_generic, mpfr_round_raw2, mpfr_round_raw, mpfr_prec_round,
mpfr_can_round, mpfr_can_round_raw -- various rounding functions
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c b/Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c
index fe777208adb..b6384a687cc 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/round_raw_generic.c
@@ -1,6 +1,6 @@
/* mpfr_round_raw_generic -- Generic rounding function
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/scale2.c b/Build/source/libs/mpfr/mpfr-src/src/scale2.c
index 17bc2f9e7f2..db68307df91 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/scale2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/scale2.c
@@ -1,6 +1,6 @@
/* mpfr_scale2 -- multiply a double float by 2^exp
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sec.c b/Build/source/libs/mpfr/mpfr-src/src/sec.c
index b8beb406684..c0fac2e598b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sec.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sec.c
@@ -1,6 +1,6 @@
/* mpfr_sec - secant function = 1/cos.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sech.c b/Build/source/libs/mpfr/mpfr-src/src/sech.c
index 8e805c1526c..ac66051e3d5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sech.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sech.c
@@ -1,6 +1,6 @@
/* mpfr_sech - Hyperbolic secant function = 1/cosh.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set.c b/Build/source/libs/mpfr/mpfr-src/src/set.c
index c751fd895cf..86661617cbd 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set.c
@@ -1,6 +1,6 @@
/* mpfr_set -- copy of a floating-point number
-Copyright 1999, 2001-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -69,6 +69,11 @@ mpfr_set4 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, int signb)
int
mpfr_set (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
{
+ /* Contrary to other mpfr_set4 based functions (mpfr_abs, mpfr_neg, etc.),
+ do not detect the case a == b as there is no interest to call mpfr_set
+ in this case, so that it is very unlikely that the user calls it
+ with a == b (this is the reverse of what is assumed for the other
+ functions). */
return mpfr_set4 (a, b, rnd_mode, MPFR_SIGN (b));
}
@@ -77,7 +82,16 @@ mpfr_set (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
int
mpfr_abs (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
{
- return mpfr_set4 (a, b, rnd_mode, MPFR_SIGN_POS);
+ if (MPFR_UNLIKELY (a != b))
+ return mpfr_set4 (a, b, rnd_mode, MPFR_SIGN_POS);
+ else
+ {
+ MPFR_SET_POS (a);
+ if (MPFR_UNLIKELY (MPFR_IS_NAN (b)))
+ MPFR_RET_NAN;
+ else
+ MPFR_RET (0);
+ }
}
/* Round (u, inex) into s with rounding mode rnd_mode, where inex is
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_d.c b/Build/source/libs/mpfr/mpfr-src/src/set_d.c
index ac28c15eb00..6c521231b82 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_d.c
@@ -1,7 +1,7 @@
/* mpfr_set_d -- convert a machine double precision float to
a multiple precision floating-point number
-Copyright 1999-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -191,8 +191,9 @@ extract_double (mpfr_limb_ptr rp, double d)
#ifndef __clang__
man[0] = d;
#else
- /* clang produces an invalid exception when d >= 2^63,
- see <https://bugs.llvm.org/show_bug.cgi?id=17686>.
+ /* clang up to version 11 produces an invalid exception when d >= 2^63,
+ see <https://github.com/llvm/llvm-project/issues/18060>
+ (old URL: <https://bugs.llvm.org/show_bug.cgi?id=17686>).
Since this is always the case, here, we use the following patch. */
MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 64);
man[0] = 0x8000000000000000 + (mp_limb_t) (d - 0x8000000000000000);
@@ -248,6 +249,7 @@ mpfr_set_d (mpfr_ptr r, double d, mpfr_rnd_t rnd_mode)
if (MPFR_UNLIKELY(DOUBLE_ISNAN(d)))
{
+ /* we don't propagate the sign bit */
MPFR_SET_NAN(r);
MPFR_RET_NAN;
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_d128.c b/Build/source/libs/mpfr/mpfr-src/src/set_d128.c
index dcc13823deb..7565abd3eec 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_d128.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_d128.c
@@ -3,9 +3,9 @@
See https://gcc.gnu.org/legacy-ml/gcc/2006-06/msg00691.html,
https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html,
-and TR 24732 <http://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
+and TR 24732 <https://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
-Copyright 2006-2022 Free Software Foundation, Inc.
+Copyright 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramel projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -278,6 +278,7 @@ decimal128_to_string (char *s, _Decimal128 d)
if (MPFR_UNLIKELY (DOUBLE_ISNAN (d))) /* NaN */
{
+ /* we don't propagate the sign bit */
sprintf (s, "NaN"); /* sprintf puts a final '\0' */
return;
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_d64.c b/Build/source/libs/mpfr/mpfr-src/src/set_d64.c
index b351c903046..c8c99240531 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_d64.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_d64.c
@@ -3,9 +3,9 @@
See https://gcc.gnu.org/legacy-ml/gcc/2006-06/msg00691.html,
https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html,
-and TR 24732 <http://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
+and TR 24732 <https://www.open-std.org/jtc1/sc22/wg14/www/projects#24732>.
-Copyright 2006-2022 Free Software Foundation, Inc.
+Copyright 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -289,6 +289,7 @@ decimal64_to_string (char *s, _Decimal64 d)
if (MPFR_UNLIKELY (DOUBLE_ISNAN (d))) /* NaN */
{
+ /* we don't propagate the sign bit */
sprintf (s, "NaN"); /* sprintf puts a final '\0' */
return;
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c b/Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c
index 8528a96bd57..ece301079b0 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_dfl_prec.c
@@ -1,6 +1,6 @@
/* mpfr_set_default_prec, mpfr_get_default_prec -- set/get default precision
-Copyright 1999-2001, 2004-2022 Free Software Foundation, Inc.
+Copyright 1999-2001, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_exp.c b/Build/source/libs/mpfr/mpfr-src/src/set_exp.c
index beb3a638f06..5c9759f6997 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_exp.c
@@ -1,6 +1,6 @@
/* mpfr_set_exp - set the exponent of a floating-point number
-Copyright 2002-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2002-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_f.c b/Build/source/libs/mpfr/mpfr-src/src/set_f.c
index 1eb66928478..32dadce0d17 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_f.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_f.c
@@ -1,6 +1,6 @@
/* mpfr_set_f -- set a MPFR number from a GNU MPF number
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_float128.c b/Build/source/libs/mpfr/mpfr-src/src/set_float128.c
index 92fc134c601..cc3415b84a4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_float128.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_float128.c
@@ -1,7 +1,7 @@
/* mpfr_set_float128 -- convert a machine _Float128 number to
a multiple precision floating-point number
-Copyright 2012-2022 Free Software Foundation, Inc.
+Copyright 2012-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_flt.c b/Build/source/libs/mpfr/mpfr-src/src/set_flt.c
index 5cab0586d11..5b59875eba5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_flt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_flt.c
@@ -1,6 +1,6 @@
/* mpfr_set_flt -- convert a machine single precision float to mpfr_t
-Copyright 2009-2022 Free Software Foundation, Inc.
+Copyright 2009-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -26,9 +26,9 @@ int
mpfr_set_flt (mpfr_ptr r, float f, mpfr_rnd_t rnd_mode)
{
/* we convert f to double precision and use mpfr_set_d;
- NaN and infinities should be preserved, and all single precision
- numbers are exactly representable in the double format, thus the
- conversion is always exact */
+ NaN and infinities should be preserved (except the sign bit for NaN),
+ and all single precision numbers are exactly representable in the double
+ format, thus the conversion is always exact */
return mpfr_set_d (r, (double) f, rnd_mode);
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_inf.c b/Build/source/libs/mpfr/mpfr-src/src/set_inf.c
index d79cf943313..524e405c3a4 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_inf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_inf.c
@@ -1,6 +1,6 @@
-/* mpfr_set_inf -- set a number to plus or minus infinity.
+/* mpfr_set_inf -- set a number to positive or negative infinity.
-Copyright 2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_ld.c b/Build/source/libs/mpfr/mpfr-src/src/set_ld.c
index 4ed6c25e132..29219e6cdfa 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_ld.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_ld.c
@@ -1,7 +1,7 @@
/* mpfr_set_ld -- convert a machine long double to
a multiple precision floating-point number
-Copyright 2002-2022 Free Software Foundation, Inc.
+Copyright 2002-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -29,7 +29,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* To check for +inf, one can use the test x > LDBL_MAX, as LDBL_MAX is
the maximum finite number representable in a long double, according
to DR 467; see
- http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2092.htm
+ https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2092.htm
If this fails on some platform, a test x - x != 0 might be used. */
#if defined(HAVE_LDOUBLE_IS_DOUBLE)
@@ -72,6 +72,7 @@ mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
/* Check for NAN */
if (MPFR_UNLIKELY (DOUBLE_ISNAN (d)))
{
+ /* we don't propagate the sign bit */
MPFR_SET_NAN (r);
MPFR_RET_NAN;
}
@@ -176,7 +177,8 @@ mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
#elif defined(HAVE_LDOUBLE_MAYBE_DOUBLE_DOUBLE)
-/* double-double code */
+/* double-double code, see
+ https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config/rs6000/ibm-ldouble-format;h=e8ada17f7696cd942e710d5b67d4149f5fcccf45;hb=HEAD */
int
mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
{
@@ -185,8 +187,9 @@ mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
double h, l;
MPFR_SAVE_EXPO_DECL (expo);
- /* Check for NAN */
- LONGDOUBLE_NAN_ACTION (d, goto nan);
+ /* Check for NAN. Since we can't use isnan(), we rely on the
+ LONGDOUBLE_NAN_ACTION macro. The sign bit is not propagated. */
+ LONGDOUBLE_NAN_ACTION (d, { MPFR_SET_NAN(r); MPFR_RET_NAN; });
/* Check for INF */
if (d > LDBL_MAX)
@@ -226,10 +229,6 @@ mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_FREE (expo);
inexact = mpfr_check_range (r, inexact, rnd_mode);
return inexact;
-
- nan:
- MPFR_SET_NAN(r);
- MPFR_RET_NAN;
}
#else
@@ -243,8 +242,9 @@ mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
long double x;
MPFR_SAVE_EXPO_DECL (expo);
- /* Check for NAN */
- LONGDOUBLE_NAN_ACTION (d, goto nan);
+ /* Check for NAN. Since we can't use isnan(), we rely on the
+ LONGDOUBLE_NAN_ACTION macro. The sign bit is not propagated. */
+ LONGDOUBLE_NAN_ACTION (d, { MPFR_SET_NAN(r); MPFR_RET_NAN; });
/* Check for INF */
if (d > LDBL_MAX)
@@ -415,10 +415,6 @@ mpfr_set_ld (mpfr_ptr r, long double d, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_FREE (expo);
return mpfr_check_range (r, inexact, rnd_mode);
-
- nan:
- MPFR_SET_NAN(r);
- MPFR_RET_NAN;
}
#endif
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_nan.c b/Build/source/libs/mpfr/mpfr-src/src/set_nan.c
index 011046822ef..5199b33281a 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_nan.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_nan.c
@@ -1,6 +1,6 @@
/* mpfr_set_nan -- set a number to NaN.
-Copyright 2002, 2006-2022 Free Software Foundation, Inc.
+Copyright 2002, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c b/Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c
index 58ef2afea76..f8171fd5fc6 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_prc_raw.c
@@ -1,6 +1,6 @@
/* mpfr_set_prec_raw -- reset the precision of a floating-point number
-Copyright 2000-2001, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2001, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 feb6443d2c8..54d610d6776 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_prec.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_prec.c
@@ -1,6 +1,6 @@
/* mpfr_set_prec -- reset the precision of a floating-point number
-Copyright 1999, 2001-2002, 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001-2002, 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -27,6 +27,8 @@ mpfr_set_prec (mpfr_ptr x, mpfr_prec_t p)
{
mp_size_t xsize, xoldsize;
+ MPFR_LOG_MSG (("prec=%Pu\n", p));
+
/* first, check if p is correct */
MPFR_ASSERTN (MPFR_PREC_COND (p));
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_q.c b/Build/source/libs/mpfr/mpfr-src/src/set_q.c
index 1d2e16b8556..4784ed3554c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_q.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_q.c
@@ -1,6 +1,6 @@
/* mpfr_set_q -- set a floating-point number from a multiple-precision rational
-Copyright 2000-2002, 2004-2022 Free Software Foundation, Inc.
+Copyright 2000-2002, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_rnd.c b/Build/source/libs/mpfr/mpfr-src/src/set_rnd.c
index 558b7863fb6..9b77ffb846d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_rnd.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_rnd.c
@@ -1,7 +1,7 @@
/* mpfr_set_default_rounding_mode -- set the default rounding mode
mpfr_get_default_rounding_mode -- get the default rounding mode
-Copyright 1999, 2001, 2004-2022 Free Software Foundation, Inc.
+Copyright 1999, 2001, 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_si.c b/Build/source/libs/mpfr/mpfr-src/src/set_si.c
index 46bb82a7653..5c0a1c8d6fc 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_si.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_si.c
@@ -1,6 +1,6 @@
/* mpfr_set_si -- set a MPFR number from a machine signed integer
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c b/Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c
index a4676598ca6..cc378b265f2 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_si_2exp.c
@@ -1,7 +1,7 @@
/* mpfr_set_si_2exp -- set a MPFR number from a machine signed integer with
a shift
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_sj.c b/Build/source/libs/mpfr/mpfr-src/src/set_sj.c
index 27baef390c4..4a3c8bd440b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_sj.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_sj.c
@@ -1,6 +1,6 @@
/* mpfr_set_sj -- set a MPFR number from a huge machine signed integer
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_str.c b/Build/source/libs/mpfr/mpfr-src/src/set_str.c
index 5107c49c3e5..e6fefd0a659 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_str.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_str.c
@@ -1,6 +1,6 @@
/* mpfr_set_str -- set a floating-point number from a string
-Copyright 2000-2022 Free Software Foundation, Inc.
+Copyright 2000-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c b/Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c
index f8f577439b7..844dedca56f 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_str_raw.c
@@ -1,6 +1,6 @@
/* mpfr_set_str_binary -- set a floating-point number from a binary string
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_ui.c b/Build/source/libs/mpfr/mpfr-src/src/set_ui.c
index 32199a84097..435a4109ddf 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_ui.c
@@ -1,6 +1,6 @@
/* mpfr_set_ui -- set a MPFR number from a machine unsigned integer
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c b/Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c
index cc12f5f1dfc..b3c1dd43a4c 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_ui_2exp.c
@@ -1,7 +1,7 @@
/* mpfr_set_ui_2exp -- set a MPFR number from a machine unsigned integer with
a shift
-Copyright 2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_uj.c b/Build/source/libs/mpfr/mpfr-src/src/set_uj.c
index 1cfae29ed6d..3dcb2cbfd98 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_uj.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_uj.c
@@ -1,6 +1,6 @@
/* mpfr_set_uj -- set a MPFR number from a huge machine unsigned integer
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_z.c b/Build/source/libs/mpfr/mpfr-src/src/set_z.c
index 63febfd8f0a..8e794c6727b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_z.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_z.c
@@ -1,6 +1,6 @@
/* mpfr_set_z -- set a floating-point number from a multiple-precision integer
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_z_exp.c b/Build/source/libs/mpfr/mpfr-src/src/set_z_2exp.c
index 51704e1768a..ccfa47e4320 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_z_exp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_z_2exp.c
@@ -1,7 +1,7 @@
/* mpfr_set_z_2exp -- set a floating-point number from a multiple-precision
integer and an exponent
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/set_zero.c b/Build/source/libs/mpfr/mpfr-src/src/set_zero.c
index 0b3a26f365b..b79208cb21b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/set_zero.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/set_zero.c
@@ -1,6 +1,6 @@
-/* mpfr_set_zero -- set a number to plus or minus zero.
+/* mpfr_set_zero -- set a number to positive or negative zero.
-Copyright 2009-2022 Free Software Foundation, Inc.
+Copyright 2009-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/setmax.c b/Build/source/libs/mpfr/mpfr-src/src/setmax.c
index c221033a89e..aefc6ad9250 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/setmax.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/setmax.c
@@ -1,6 +1,6 @@
/* mpfr_setmax -- maximum representable floating-point number (raw version)
-Copyright 2002-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2002-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/setmin.c b/Build/source/libs/mpfr/mpfr-src/src/setmin.c
index 4160b08503b..ffb1d7732bf 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/setmin.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/setmin.c
@@ -1,6 +1,6 @@
/* mpfr_setmin -- minimum representable floating-point number (raw version)
-Copyright 2002-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2002-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/setsign.c b/Build/source/libs/mpfr/mpfr-src/src/setsign.c
index a4e6e0aaac0..22d77fbf41b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/setsign.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/setsign.c
@@ -1,6 +1,6 @@
/* mpfr_setsign -- Produce a value with the magnitude of x and sign bit s
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -26,5 +26,14 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
int
mpfr_setsign (mpfr_ptr z, mpfr_srcptr x, int s, mpfr_rnd_t rnd_mode)
{
- return mpfr_set4 (z, x, rnd_mode, s ? -1 : 1);
+ if (MPFR_UNLIKELY (z != x))
+ return mpfr_set4 (z, x, rnd_mode, s ? MPFR_SIGN_NEG : MPFR_SIGN_POS);
+ else
+ {
+ MPFR_SET_SIGN (z, s ? MPFR_SIGN_NEG : MPFR_SIGN_POS);
+ if (MPFR_UNLIKELY (MPFR_IS_NAN (x)))
+ MPFR_RET_NAN;
+ else
+ MPFR_RET (0);
+ }
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sgn.c b/Build/source/libs/mpfr/mpfr-src/src/sgn.c
index 45ed4761ba4..b21c02e0705 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sgn.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sgn.c
@@ -1,6 +1,6 @@
/* mpfr_sgn -- Sign of a floating point number.
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 43a028b58ac..71fa91fcf64 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/si_op.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/si_op.c
@@ -5,7 +5,7 @@
mpfr_div_si -- divide a floating-point number by a machine integer
mpfr_si_div -- divide a machine number by a floating-point number
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/signbit.c b/Build/source/libs/mpfr/mpfr-src/src/signbit.c
index c972539e15b..09d0aa60016 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/signbit.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/signbit.c
@@ -1,6 +1,6 @@
/* mpfr_signbit -- Signbit of a MPFR number
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sin.c b/Build/source/libs/mpfr/mpfr-src/src/sin.c
index 2e9735029e5..7b4252e6d55 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sin.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sin.c
@@ -1,6 +1,6 @@
/* mpfr_sin -- sine of a floating-point number
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -99,14 +99,22 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
m += err1;
}
- mpfr_init (c);
- mpfr_init (xr);
+ if (expx >= 2)
+ {
+ mpfr_init2 (c, expx + m - 1);
+ mpfr_init2 (xr, m);
+ }
+ else
+ mpfr_init2 (c, m);
MPFR_ZIV_INIT (loop, m);
for (;;)
{
/* first perform argument reduction modulo 2*Pi (if needed),
also helps to determine the sign of sin(x) */
+ /* TODO: Perform range reduction in a way so that the sine can
+ be computed directly from the cosine with sin(x)=cos(pi/2-x),
+ without the need of sqrt(1 - x^2). */
if (expx >= 2) /* If Pi < x < 4, we need to reduce too, to determine
the sign of sin(x). For 2 <= |x| < Pi, we could avoid
the reduction. */
@@ -193,7 +201,8 @@ mpfr_sin (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
within the target precision, but in that case mpfr_can_round will fail */
mpfr_clear (c);
- mpfr_clear (xr);
+ if (expx >= 2)
+ mpfr_clear (xr);
end:
MPFR_SAVE_EXPO_FREE (expo);
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 73e7f853445..3960759633b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sin_cos.c
@@ -1,6 +1,6 @@
/* mpfr_sin_cos -- sine and cosine of a floating-point number
-Copyright 2002-2022 Free Software Foundation, Inc.
+Copyright 2002-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -131,8 +131,8 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
return mpfr_sincos_fast (y, z, x, rnd_mode);
}
- mpfr_init (c);
- mpfr_init (xr);
+ mpfr_init2 (c, m);
+ mpfr_init2 (xr, m);
MPFR_ZIV_INIT (loop, m);
for (;;)
@@ -141,6 +141,7 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
if (expx >= 2) /* reduce the argument */
{
reduce = 1;
+ MPFR_ASSERTN (expx + m - 1 <= MPFR_PREC_MAX);
mpfr_set_prec (c, expx + m - 1);
mpfr_set_prec (xr, m);
mpfr_const_pi (c, MPFR_RNDN);
@@ -177,9 +178,10 @@ mpfr_sin_cos (mpfr_ptr y, mpfr_ptr z, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
if (!MPFR_CAN_ROUND (c, err, MPFR_PREC (z), rnd_mode))
goto next_step;
- /* we can't set z now, because in case z = x, and the MPFR_CAN_ROUND()
- call below fails, we will have clobbered the input */
- mpfr_set_prec (xr, MPFR_PREC(c));
+ /* We can't set z now, because in case z = x, and the MPFR_CAN_ROUND()
+ call below fails, we will have clobbered the input.
+ Note: m below is the precision of c; see above. */
+ mpfr_set_prec (xr, m);
mpfr_swap (xr, c); /* save the approximation of the cosine in xr */
mpfr_sqr (c, xr, MPFR_RNDU); /* the absolute error is bounded by
2^(5-m) if reduce=1, and by 2^(2-m)
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sinh.c b/Build/source/libs/mpfr/mpfr-src/src/sinh.c
index 07d2ea274bc..6d54ba887cc 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sinh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sinh.c
@@ -1,6 +1,6 @@
/* mpfr_sinh -- hyperbolic sine
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 c0ed0325556..d3602cc8245 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sinh_cosh.c
@@ -1,6 +1,6 @@
/* mpfr_sinh_cosh -- hyperbolic sine and cosine
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sinu.c b/Build/source/libs/mpfr/mpfr-src/src/sinu.c
new file mode 100644
index 00000000000..9e4e1ed017c
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/sinu.c
@@ -0,0 +1,240 @@
+/* mpfr_sinu -- sinu(x) = sin(2*pi*x/u)
+ mpfr_sinpi -- sinpi(x) = sin(pi*x)
+
+Copyright 2020-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* References:
+ * Steve Kargl wrote sinpi and friends for FreeBSD's libm under BSD
+ license:
+ https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218514
+ */
+
+/* put in y the correctly rounded value of sin(2*pi*x/u) */
+int
+mpfr_sinu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_srcptr xp;
+ mpfr_prec_t precy, prec;
+ mpfr_exp_t expx, expt, err;
+ mpfr_t t, xr;
+ int inexact = 0, nloops = 0, underflow = 0;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*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,
+ inexact));
+
+ if (u == 0 || MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ /* for u=0, return NaN */
+ if (u == 0 || MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Range reduction. We do not need to reduce the argument if it is
+ already reduced (|x| < u).
+ Note that the case |x| = u is better in the "else" branch as it
+ will give xr = 0. */
+ if (mpfr_cmpabs_ui (x, u) < 0)
+ {
+ xp = x;
+ }
+ else
+ {
+ mpfr_exp_t p = MPFR_GET_PREC (x) - MPFR_GET_EXP (x);
+ int inex;
+
+ /* Let's compute xr = x mod u, with signbit(xr) = signbit(x), which
+ may be important when x is a multiple of u, in which case xr = 0
+ (but this property is actually not needed in the code below).
+ The precision of xr is chosen to ensure that x mod u is exactly
+ representable in xr, e.g., the maximum size of u + the length of
+ the fractional part of x. Note that since |x| >= u in this branch,
+ the additional memory amount will not be more than the one of x.
+ */
+ mpfr_init2 (xr, sizeof (unsigned long) * CHAR_BIT + (p < 0 ? 0 : p));
+ MPFR_DBGRES (inex = mpfr_fmod_ui (xr, x, u, MPFR_RNDN)); /* exact */
+ MPFR_ASSERTD (inex == 0);
+ if (MPFR_IS_ZERO (xr))
+ {
+ mpfr_clear (xr);
+ MPFR_SAVE_EXPO_FREE (expo);
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ xp = xr;
+ }
+
+ /* now |xp/u| < 1 */
+
+ precy = MPFR_GET_PREC (y);
+ expx = MPFR_GET_EXP (xp);
+ /* For x large, since argument reduction is expensive, we want to avoid
+ any failure in Ziv's strategy, thus we take into account expx too. */
+ prec = precy + MAX(expx, MPFR_INT_CEIL_LOG2 (precy)) + 8;
+ MPFR_ASSERTD(prec >= 2);
+ mpfr_init2 (t, prec);
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ nloops ++;
+ /* In the error analysis below, xp stands for x.
+ We first compute an approximation t of 2*pi*x/u, then call sin(t).
+ If t = 2*pi*x/u + s, then |sin(t) - sin(2*pi*x/u)| <= |s|. */
+ mpfr_set_prec (t, prec);
+ mpfr_const_pi (t, MPFR_RNDN); /* t = pi * (1 + theta1) where
+ |theta1| <= 2^-prec */
+ mpfr_mul_2ui (t, t, 1, MPFR_RNDN); /* t = 2*pi * (1 + theta1) */
+ mpfr_mul (t, t, xp, MPFR_RNDN); /* t = 2*pi*x * (1 + theta2)^2 where
+ |theta2| <= 2^-prec */
+ mpfr_div_ui (t, t, u, MPFR_RNDN); /* t = 2*pi*x/u * (1 + theta3)^3 where
+ |theta3| <= 2^-prec */
+ /* if t is zero here, it means the division by u underflows, then
+ sin(t) also underflows, since |sin(x)| <= |x|. */
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (t)))
+ {
+ inexact = mpfr_underflow (y, rnd_mode, MPFR_SIGN(t));
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_INEXACT
+ | MPFR_FLAGS_UNDERFLOW);
+ underflow = 1;
+ goto end;
+ }
+ /* since prec >= 2, |(1 + theta3)^3 - 1| <= 4*theta3 <= 2^(2-prec) */
+ expt = MPFR_GET_EXP (t);
+ /* we have |s| <= 2^(expt + 2 - prec) */
+ mpfr_sin (t, t, MPFR_RNDA);
+ /* t cannot be zero here, since we excluded t=0 before, which is the
+ only exact case where sin(t)=0, and we round away from zero */
+ err = expt + 2 - prec;
+ expt = MPFR_GET_EXP (t); /* new exponent of t */
+ /* the total error is bounded by 2^err + ulp(t) = 2^err + 2^(expt-prec)
+ thus if err <= expt-prec, it is bounded by 2^(expt-prec+1),
+ otherwise it is bounded by 2^(err+1). */
+ err = (err <= expt - prec) ? expt - prec + 1 : err + 1;
+ /* normalize err for mpfr_can_round */
+ err = expt - err;
+ if (MPFR_CAN_ROUND (t, err, precy, rnd_mode))
+ break;
+ /* Check exact cases only after the first level of Ziv' strategy, to
+ avoid slowing down the average case. Exact cases are:
+ (a) 2*pi*x/u is a multiple of pi/2, i.e., x/u is a multiple of 1/4
+ (b) 2*pi*x/u is +/-pi/6 modulo pi, i.e., x/u = +/-1/12 mod 1/2 */
+ if (nloops == 1)
+ {
+ /* detect case (a) */
+ inexact = mpfr_div_ui (t, xp, u, MPFR_RNDA);
+ mpfr_mul_2ui (t, t, 2, MPFR_RNDA);
+ if (inexact == 0 && mpfr_integer_p (t))
+ {
+ if (!mpfr_odd_p (t))
+ /* t is even: we have a multiple of pi, thus sinu = 0,
+ for the sign, we follow IEEE 754-2019: sinPi(+n) is +0
+ and sinPi(-n) is -0 for positive integers n, so that the
+ function is odd. */
+ mpfr_set_zero (y, MPFR_IS_POS(t) ? +1 : -1);
+ else /* t is odd */
+ {
+ inexact = mpfr_sub_ui (t, t, 1, MPFR_RNDZ);
+ MPFR_ASSERTD(inexact == 0);
+ inexact = mpfr_div_2ui (t, t, 1, MPFR_RNDZ);
+ MPFR_ASSERTD(inexact == 0);
+ if (MPFR_IS_ZERO (t) || !mpfr_odd_p (t))
+ /* case pi/2: sinu = 1 */
+ mpfr_set_ui (y, 1, MPFR_RNDZ);
+ else
+ mpfr_set_si (y, -1, MPFR_RNDZ);
+ }
+ goto end;
+ }
+ /* detect case (b): this can only occur if u is divisible by 3 */
+ if ((u % 3) == 0)
+ {
+ inexact = mpfr_div_ui (t, xp, u / 3, MPFR_RNDZ);
+ /* t should be +/-1/4 mod 3/2 */
+ mpfr_mul_2ui (t, t, 2, MPFR_RNDZ);
+ /* t should be +/-1 mod 6, i.e., in {1,5,7,11} mod 12:
+ t = 1 mod 6: case pi/6: return 1/2
+ t = 5 mod 6: case 5pi/6: return 1/2
+ t = 7 mod 6: case 7pi/6: return -1/2
+ t = 11 mod 6: case 11pi/6: return -1/2 */
+ if (inexact == 0 && mpfr_integer_p (t))
+ {
+ mpz_t z;
+ unsigned long mod12;
+ mpz_init (z);
+ inexact = mpfr_get_z (z, t, MPFR_RNDZ);
+ MPFR_ASSERTN(inexact == 0);
+ mod12 = mpz_fdiv_ui (z, 12);
+ mpz_clear (z);
+ if (mod12 == 1 || mod12 == 5)
+ {
+ mpfr_set_ui_2exp (y, 1, -1, MPFR_RNDZ);
+ goto end;
+ }
+ else if (mod12 == 7 || mod12 == 11)
+ {
+ mpfr_set_si_2exp (y, -1, -1, MPFR_RNDZ);
+ goto end;
+ }
+ }
+ }
+ }
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ end:
+ mpfr_clear (t);
+ if (xp != x)
+ {
+ MPFR_ASSERTD (xp == xr);
+ mpfr_clear (xr);
+ }
+ MPFR_SAVE_EXPO_FREE (expo);
+ return underflow ? inexact : mpfr_check_range (y, inexact, rnd_mode);
+}
+
+int
+mpfr_sinpi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_sinu (y, x, 2, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h
index 2d10989522e..7735f3e98ba 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/sparc64/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sqr.c b/Build/source/libs/mpfr/mpfr-src/src/sqr.c
index 9978d138a15..74309be6fcb 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sqr.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sqr.c
@@ -1,6 +1,6 @@
/* mpfr_sqr -- Floating-point square
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sqrt.c b/Build/source/libs/mpfr/mpfr-src/src/sqrt.c
index fe67b4b486d..4252122a0fc 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sqrt.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sqrt.c
@@ -1,6 +1,6 @@
/* mpfr_sqrt -- square root of a floating-point number
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 25cd14b6cae..318daaa03ad 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sqrt_ui.c
@@ -1,6 +1,6 @@
/* mpfr_sqrt_ui -- square root of a machine integer
-Copyright 2000-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -26,10 +26,16 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
int
mpfr_sqrt_ui (mpfr_ptr r, unsigned long u, mpfr_rnd_t rnd_mode)
{
- if (u)
+ int inex;
+
+ MPFR_LOG_FUNC
+ (("u=%lu rnd=%d", u, rnd_mode),
+ ("y[%Pu]=%.*Rg inexact=%d",
+ mpfr_get_prec(r), mpfr_log_prec, r, inex));
+
+ if (u != 0)
{
mpfr_t uu;
- int inex;
#ifdef MPFR_LONG_WITHIN_LIMB
mp_limb_t up[1];
int cnt;
@@ -54,7 +60,8 @@ mpfr_sqrt_ui (mpfr_ptr r, unsigned long u, mpfr_rnd_t rnd_mode)
mpfr_clear (uu);
#endif /* MPFR_LONG_WITHIN_LIMB */
MPFR_SAVE_EXPO_FREE (expo);
- return mpfr_check_range (r, inex, rnd_mode);
+ inex = mpfr_check_range (r, inex, rnd_mode);
+ return inex;
}
else /* sqrt(0) = 0 */
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/stack_interface.c b/Build/source/libs/mpfr/mpfr-src/src/stack_interface.c
index 83394b1d925..640326f1573 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/stack_interface.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/stack_interface.c
@@ -1,7 +1,7 @@
/* custom interface -- initialize a floating-point number with given
allocation area
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/strtofr.c b/Build/source/libs/mpfr/mpfr-src/src/strtofr.c
index 8a8d63c7126..a95d242bea2 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/strtofr.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/strtofr.c
@@ -1,6 +1,6 @@
/* mpfr_strtofr -- set a floating-point number from a string
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub.c b/Build/source/libs/mpfr/mpfr-src/src/sub.c
index 50dfd17e9e3..c1d47e4e461 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub.c
@@ -1,6 +1,6 @@
/* mpfr_sub -- subtract two floating-point numbers
-Copyright 2001-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2001-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub1.c b/Build/source/libs/mpfr/mpfr-src/src/sub1.c
index 13fe7ee7281..e4cd2ed4ef0 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub1.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub1.c
@@ -1,6 +1,6 @@
/* mpfr_sub1 -- internal function to perform a "real" subtraction
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub1sp.c b/Build/source/libs/mpfr/mpfr-src/src/sub1sp.c
index 67b803d56ac..e9c2b51b5eb 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub1sp.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub1sp.c
@@ -1,7 +1,7 @@
/* mpfr_sub1sp -- internal function to perform a "real" subtraction
All the op must have the same precision
-Copyright 2003-2022 Free Software Foundation, Inc.
+Copyright 2003-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sub1sp1_extracted.c b/Build/source/libs/mpfr/mpfr-src/src/sub1sp1_extracted.c
index 709cb146132..eb325bdaadc 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub1sp1_extracted.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub1sp1_extracted.c
@@ -4,7 +4,7 @@
Source: https://github.com/project-everest/hacl-star/tree/dev_mpfr/code/mpfr
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 caa9882619e..29f32502bc8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub_d.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub_d.c
@@ -1,7 +1,7 @@
/* mpfr_sub_d -- subtract a machine double precision float from
a multiple precision floating-point number
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 024f1d9a414..f57c11cdd48 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sub_ui.c
@@ -1,6 +1,6 @@
/* mpfr_sub_ui -- subtract a floating-point number and a machine integer
-Copyright 2000-2022 Free Software Foundation, Inc.
+Copyright 2000-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/subnormal.c b/Build/source/libs/mpfr/mpfr-src/src/subnormal.c
index 60ce90754f5..4c3b6c82da0 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/subnormal.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/subnormal.c
@@ -1,7 +1,7 @@
/* mpfr_subnormalize -- Subnormalize a floating point number
emulating sub-normal numbers.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -32,7 +32,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
1 | 0 | -1 | AddOneUlp |
1 | 1 | ? | AddOneUlp |
- For other rounding mode, there isn't such a problem.
+ For other rounding modes, there isn't such a problem.
Just round it again and merge the ternary values.
Set the inexact flag if the returned ternary value is non-zero.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/sum.c b/Build/source/libs/mpfr/mpfr-src/src/sum.c
index 42002de39c7..86e1fe4fa30 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/sum.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/sum.c
@@ -1,6 +1,6 @@
/* Sum -- efficiently sum a list of floating-point numbers
-Copyright 2014-2022 Free Software Foundation, Inc.
+Copyright 2014-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/swap.c b/Build/source/libs/mpfr/mpfr-src/src/swap.c
index fc16cbf8925..f6a56cade56 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/swap.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/swap.c
@@ -1,6 +1,6 @@
/* mpfr_swap (U, V) -- Swap U and V.
-Copyright 2000-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/tan.c b/Build/source/libs/mpfr/mpfr-src/src/tan.c
index f2e3dcfe9f1..79f1ad3b348 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/tan.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/tan.c
@@ -1,6 +1,6 @@
/* mpfr_tan -- tangent of a floating-point number
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/tanh.c b/Build/source/libs/mpfr/mpfr-src/src/tanh.c
index e52f0e4094c..50ec630acfa 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/tanh.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/tanh.c
@@ -1,6 +1,6 @@
/* mpfr_tanh -- hyperbolic tangent
-Copyright 2001-2022 Free Software Foundation, Inc.
+Copyright 2001-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/tanu.c b/Build/source/libs/mpfr/mpfr-src/src/tanu.c
new file mode 100644
index 00000000000..a53bb26b15b
--- /dev/null
+++ b/Build/source/libs/mpfr/mpfr-src/src/tanu.c
@@ -0,0 +1,227 @@
+/* mpfr_tanu -- tanu(x) = tan(2*pi*x/u)
+ mpfr_tanpi -- tanpi(x) = tan(pi*x)
+
+Copyright 2020-2023 Free Software Foundation, Inc.
+Contributed by the AriC and Caramba projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
+https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+/* put in y the correctly rounded value of tan(2*pi*x/u) */
+int
+mpfr_tanu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
+{
+ mpfr_srcptr xp;
+ mpfr_prec_t precy, prec;
+ mpfr_exp_t expx, expt, err;
+ mpfr_t t, xr;
+ int inexact = 0, nloops = 0, underflow = 0;
+ MPFR_ZIV_DECL (loop);
+ MPFR_SAVE_EXPO_DECL (expo);
+
+ MPFR_LOG_FUNC (
+ ("x[%Pu]=%.*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,
+ inexact));
+
+ if (u == 0 || MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
+ {
+ /* for u=0, return NaN */
+ if (u == 0 || MPFR_IS_NAN (x) || MPFR_IS_INF (x))
+ {
+ MPFR_SET_NAN (y);
+ MPFR_RET_NAN;
+ }
+ else /* x is zero */
+ {
+ MPFR_ASSERTD (MPFR_IS_ZERO (x));
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ }
+
+ MPFR_SAVE_EXPO_MARK (expo);
+
+ /* Range reduction. We do not need to reduce the argument if it is
+ already reduced (|x| < u).
+ Note that the case |x| = u is better in the "else" branch as it
+ will give xr = 0. */
+ if (mpfr_cmpabs_ui (x, u) < 0)
+ {
+ xp = x;
+ }
+ else
+ {
+ mpfr_exp_t p = MPFR_GET_PREC (x) - MPFR_GET_EXP (x);
+ int inex;
+
+ /* Let's compute xr = x mod u, with signbit(xr) = signbit(x), which
+ may be important when x is a multiple of u, in which case xr = 0
+ (but this property is actually not needed in the code below).
+ The precision of xr is chosen to ensure that x mod u is exactly
+ representable in xr, e.g., the maximum size of u + the length of
+ the fractional part of x. Note that since |x| >= u in this branch,
+ the additional memory amount will not be more than the one of x.
+ Note that due to the rules on the special values, we needed to
+ consider a period of u instead of u/2. */
+ mpfr_init2 (xr, sizeof (unsigned long) * CHAR_BIT + (p < 0 ? 0 : p));
+ MPFR_DBGRES (inex = mpfr_fmod_ui (xr, x, u, MPFR_RNDN)); /* exact */
+ MPFR_ASSERTD (inex == 0);
+ if (MPFR_IS_ZERO (xr))
+ {
+ mpfr_clear (xr);
+ MPFR_SAVE_EXPO_FREE (expo);
+ MPFR_SET_ZERO (y);
+ MPFR_SET_SAME_SIGN (y, x);
+ MPFR_RET (0);
+ }
+ xp = xr;
+ }
+
+ /* now |xp/u| < 1 */
+
+ precy = MPFR_GET_PREC (y);
+ expx = MPFR_GET_EXP (xp);
+ /* For x large, since argument reduction is expensive, we want to avoid
+ any failure in Ziv's strategy, thus we take into account expx too. */
+ prec = precy + MAX(expx,MPFR_INT_CEIL_LOG2(precy)) + 8;
+ MPFR_ASSERTD(prec >= 2);
+ mpfr_init2 (t, prec);
+ MPFR_ZIV_INIT (loop, prec);
+ for (;;)
+ {
+ int inex;
+ nloops ++;
+ /* In the error analysis below, xp stands for x.
+ We first compute an approximation t of 2*pi*x/u, then call tan(t).
+ If t = 2*pi*x/u + s, then
+ |tan(t) - tan(2*pi*x/u)| = |s| * (1 + tan(v)^2) where v is in the
+ interval [t, t+s]. If we ensure that |t| >= |2*pi*x/u|, since tan() is
+ increasing, we can bound tan(v)^2 by tan(t)^2. */
+ mpfr_set_prec (t, prec);
+ mpfr_const_pi (t, MPFR_RNDU); /* t = pi * (1 + theta1) where
+ |theta1| <= 2^(1-prec) */
+ mpfr_mul_2ui (t, t, 1, MPFR_RNDN); /* t = 2*pi * (1 + theta1) */
+ mpfr_mul (t, t, xp, MPFR_RNDA); /* t = 2*pi*x * (1 + theta2)^2 where
+ |theta2| <= 2^(1-prec) */
+ inex = mpfr_div_ui (t, t, u, MPFR_RNDN);
+ /* t = 2*pi*x/u * (1 + theta3)^3 where |theta3| <= 2^(1-prec) */
+ /* if t is zero here, it means the division by u underflows, then
+ tan(t) also underflows, since |tan(x)| <= |x|. */
+ if (MPFR_UNLIKELY (MPFR_IS_ZERO (t)))
+ {
+ inexact = mpfr_underflow (y, rnd_mode, MPFR_SIGN(t));
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_INEXACT
+ | MPFR_FLAGS_UNDERFLOW);
+ underflow = 1;
+ goto end;
+ }
+ /* emulate mpfr_div_ui (t, t, u, MPFR_RNDA) above, so that t is rounded
+ away from zero */
+ if (MPFR_SIGN(t) > 0 && inex < 0)
+ mpfr_nextabove (t);
+ else if (MPFR_SIGN(t) < 0 && inex > 0)
+ mpfr_nextbelow (t);
+ expt = MPFR_GET_EXP (t);
+ /* since prec >= 3, |(1 + theta3)^3 - 1| <= 4*theta3 <= 2^(3-prec)
+ thus |s| = |t - 2*pi*x/u| <= |t| * 2^(3-prec) */
+ mpfr_tan (t, t, MPFR_RNDA);
+ {
+ /* compute an upper bound for 1+tan(t)^2 */
+ mpfr_t z;
+ mpfr_init2 (z, 64);
+ mpfr_sqr (z, t, MPFR_RNDU);
+ mpfr_add_ui (z, z, 1, MPFR_RNDU);
+ expt += MPFR_GET_EXP (z);
+ /* now |t - tan(2*pi*x/u)| <= ulp(t) + 2^(expt + 3 - prec) */
+ mpfr_clear (z);
+ }
+ /* t cannot be zero here, since we excluded t=0 before, which is the
+ only exact case where tan(t)=0, and we round away from zero */
+ err = expt + 3 - prec;
+ expt = MPFR_GET_EXP (t); /* new exponent of t */
+ /* the total error is bounded by 2^err + ulp(t) = 2^err + 2^(expt-prec)
+ thus if err <= expt-prec, it is bounded by 2^(expt-prec+1),
+ otherwise it is bounded by 2^(err+1). */
+ err = (err <= expt - prec) ? expt - prec + 1 : err + 1;
+ /* normalize err for mpfr_can_round */
+ err = expt - err;
+ if (MPFR_CAN_ROUND (t, err, precy, rnd_mode))
+ break;
+ /* Check exact cases only after the first level of Ziv' strategy, to
+ avoid slowing down the average case. Exact cases are when 2*pi*x/u
+ is a multiple of pi/4, i.e., x/u a multiple of 1/8:
+ (a) x/u = {0,1/2} mod 1: return +0 or -0
+ (b) x/u = {1/4,3/4} mod 1: return +Inf or -Inf
+ (c) x/u = {1/8,3/8,5/8,7/8} mod 1: return 1 or -1 */
+ if (nloops == 1)
+ {
+ inexact = mpfr_div_ui (t, xp, u, MPFR_RNDA);
+ mpfr_mul_2ui (t, t, 3, MPFR_RNDA);
+ if (inexact == 0 && mpfr_integer_p (t))
+ {
+ mpz_t z;
+ unsigned long mod8;
+ mpz_init (z);
+ inexact = mpfr_get_z (z, t, MPFR_RNDZ);
+ MPFR_ASSERTN(inexact == 0);
+ mod8 = mpz_fdiv_ui (z, 8);
+ mpz_clear (z);
+ if (mod8 == 0 || mod8 == 4) /* case (a) */
+ mpfr_set_zero (y, ((mod8 == 0) ? +1 : -1) * MPFR_SIGN (x));
+ else if (mod8 == 2 || mod8 == 6) /* case (b) */
+ {
+ mpfr_set_inf (y, (mod8 == 2) ? +1 : -1);
+ MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, MPFR_FLAGS_DIVBY0);
+ }
+ else /* case (c) */
+ {
+ if (mod8 == 1 || mod8 == 5)
+ mpfr_set_ui (y, 1, rnd_mode);
+ else
+ mpfr_set_si (y, -1, rnd_mode);
+ }
+ goto end;
+ }
+ }
+ MPFR_ZIV_NEXT (loop, prec);
+ }
+ MPFR_ZIV_FREE (loop);
+
+ inexact = mpfr_set (y, t, rnd_mode);
+
+ end:
+ mpfr_clear (t);
+ if (xp != x)
+ {
+ MPFR_ASSERTD (xp == xr);
+ mpfr_clear (xr);
+ }
+ MPFR_SAVE_EXPO_FREE (expo);
+ return underflow ? inexact : mpfr_check_range (y, inexact, rnd_mode);
+}
+
+int
+mpfr_tanpi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_tanu (y, x, 2, rnd_mode);
+}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/total_order.c b/Build/source/libs/mpfr/mpfr-src/src/total_order.c
index c64053c4f2b..0d42fc1b7b8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/total_order.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/total_order.c
@@ -1,6 +1,6 @@
/* mpfr_total_order_p -- total order of two floating-point numbers
-Copyright 2018-2022 Free Software Foundation, Inc.
+Copyright 2018-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ubf.c b/Build/source/libs/mpfr/mpfr-src/src/ubf.c
index 917c98be292..b2da806d119 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ubf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ubf.c
@@ -1,6 +1,6 @@
/* Functions to work with unbounded floats (limited low-level interface).
-Copyright 2016-2022 Free Software Foundation, Inc.
+Copyright 2016-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -149,9 +149,15 @@ mpfr_ubf_mul_exact (mpfr_ubf_ptr a, mpfr_srcptr b, mpfr_srcptr c)
}
else
{
- u = (bn >= cn) ?
- mpn_mul (ap, MPFR_MANT (b), bn, MPFR_MANT (c), cn) :
- mpn_mul (ap, MPFR_MANT (c), cn, MPFR_MANT (b), bn);
+ if (b == c)
+ {
+ mpn_sqr (ap, MPFR_MANT (b), bn);
+ u = ap[2 * bn - 1];
+ }
+ else
+ u = (bn >= cn) ?
+ mpn_mul (ap, MPFR_MANT (b), bn, MPFR_MANT (c), cn) :
+ mpn_mul (ap, MPFR_MANT (c), cn, MPFR_MANT (b), bn);
if (MPFR_LIMB_MSB (u) == 0)
{
m = 1;
diff --git a/Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c b/Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c
index f05d01e544a..04736ca5aff 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/uceil_exp2.c
@@ -1,6 +1,6 @@
/* __gmpfr_ceil_exp2 - returns y >= 2^d
-Copyright 1999-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c b/Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c
index e1c55ded052..aac0b62ddac 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/uceil_log2.c
@@ -1,6 +1,6 @@
/* __gmpfr_ceil_log2 - returns ceil(log(d)/log(2))
-Copyright 1999-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c b/Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c
index 07a1ed5d98f..aaa03bb9ba5 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ufloor_log2.c
@@ -1,6 +1,6 @@
/* __gmpfr_floor_log2 - returns floor(log(d)/log(2))
-Copyright 1999-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 1999-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 600f64c4623..3a6339ca72d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ui_div.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ui_div.c
@@ -1,6 +1,6 @@
/* mpfr_ui_div -- divide a machine integer by a floating-point number
-Copyright 2000-2022 Free Software Foundation, Inc.
+Copyright 2000-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/ui_pow.c b/Build/source/libs/mpfr/mpfr-src/src/ui_pow.c
index b8ed4844bfa..4021b80d774 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ui_pow.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ui_pow.c
@@ -1,6 +1,6 @@
/* mpfr_ui_pow -- power of n function n^x
-Copyright 2001-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2001-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 3ef65064009..dd98ea2b13d 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
@@ -1,6 +1,6 @@
/* mpfr_ui_pow_ui -- compute the power between two machine integers
-Copyright 1999-2022 Free Software Foundation, Inc.
+Copyright 1999-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
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 5930050450a..512eb8a6756 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/ui_sub.c
@@ -1,6 +1,6 @@
/* mpfr_ui_sub -- subtract a floating-point number from an integer
-Copyright 2000-2022 Free Software Foundation, Inc.
+Copyright 2000-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/urandom.c b/Build/source/libs/mpfr/mpfr-src/src/urandom.c
index 98b7ca5b1eb..03c2f6a80db 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/urandom.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/urandom.c
@@ -2,7 +2,7 @@
real number between 0 and 1 (exclusive) and round it to the precision of rop
according to the given rounding mode.
-Copyright 2000-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/urandomb.c b/Build/source/libs/mpfr/mpfr-src/src/urandomb.c
index 8fc93e08284..d4e8010105d 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/urandomb.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/urandomb.c
@@ -3,7 +3,7 @@
using STATE as the random state previously initialized by a call to
gmp_randinit_lc_2exp_size().
-Copyright 2000-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2000-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c b/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c
index 60d7ef59864..50282c857b3 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/vasprintf.c
@@ -1,7 +1,7 @@
/* mpfr_vasnprintf_aux -- helper function for the formatted output functions
(printf functions family).
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -121,12 +121,22 @@ static const char num_to_text[] = "0123456789abcdef";
/* Read an integer var of type mpfr_intmax_t. In case of overflow, set
overflow to 1.
+ The variable var must be 0 on input. If there are no digits, it is
+ left to 0.
+ This macro will be used to read the field width and the precision.
+ The behavior will be similar to ISO C99. Note that unless "*" is
+ used, the result will be non-negative (ISO C99 and C11 just specify
+ "optional decimal integer" for the precision, but the behavior with
+ a hardcoded negative integer is not explicitly defined, thus it is
+ undefined, so that it is fine to reject such integers; the C2x draft
+ now clarifies this: "an optional non-negative decimal integer").
Note: Since mpfr_intmax_t = int is theoretically possible, all values
of var are potentially valid values (via '*'). Hence the need of an
overflow flag instead of a special value that would indicate overflow.
- Saturating would not be OK either as the maximum value could be
+ Just saturating would not be OK either as the maximum value could be
meaningful with %jn and/or in the case mpfr_intmax_t = int, for
- MPFR_PREC_ARG.
+ MPFR_PREC_ARG, i.e. one must be able to distinguish the maximum value
+ from an overflow.
*/
#define READ_INT(ap, format, var) \
do { \
@@ -902,6 +912,8 @@ struct number_parts
/* For a real non zero number x, what is the base exponent f when rounding x
with rounding mode r to r(x) = m*b^f, where m is a digit and 1 <= m < b ?
Return non zero value if x is rounded up to b^f, return zero otherwise */
+/* FIXME: It seems that the base-2 exponent is taken into account, which is
+ what is expected. In this case, the description is incorrect. */
static int
next_base_power_p (mpfr_srcptr x, int base, mpfr_rnd_t rnd)
{
@@ -1021,7 +1033,29 @@ mpfr_get_str_wrapper (mpfr_exp_t *exp, int base, size_t n, mpfr_srcptr op,
/* Determine the different parts of the string representation of the regular
number P when spec.spec is 'a', 'A', or 'b'.
- Return -1 in case of overflow on the sizes. */
+ Return -1 in case of overflow on the sizes.
+
+ Note for 'a'/'A': If the precision field is non-zero, the output is the
+ one with a binary exponent that is a multiple of 4 (thus this is similar
+ to base 16, where base-16 exponent = binary exponent / 4). But if the
+ precision field is 0, the exponent is no longer restricted to a multiple
+ of 4; the precision is maximized, but the displayed digit may be 1; this
+ is completely unintuitive.
+ The obtained output for 4 values with precision fields 0 and 1:
+ 0 1
+ 30 0xfp+1 0x1.ep+4
+ 31 0x1p+5 0x1.fp+4
+ 32 0x8p+2 0x2.0p+4
+ 33 0x8p+2 0x2.1p+4
+ First, the output for numbers that round up to the next power of 16
+ with a precision field 0, like 31 here, has an unexpected form: here
+ with 31, "0x1p+5" instead of "0x8p+2".
+ Moreover, if one increases the output precision, the output form
+ changes (even if no rounding is involved). For instance, for 32,
+ "0x8p+2" changes to "0x2.0p+4" instead of "0x8.0p+2".
+ FIXME: choose first digit = always 1. Discussion:
+ https://sympa.inria.fr/sympa/arc/mpfr/2021-05/msg00002.html
+*/
static int
regular_ab (struct number_parts *np, mpfr_srcptr p,
const struct printf_spec spec)
@@ -2144,13 +2178,16 @@ mpfr_vasnprintf_aux (char **ptr, char *Buf, size_t size, const char *fmt,
if (*fmt == '.')
{
- const char *f = ++fmt;
+ ++fmt;
READ_INT (ap, fmt, spec.prec);
- if (f == fmt || spec.prec < 0)
+ /* A negative value is possible with ".*" and it will be regarded
+ as a missing precision (ISO C). We need to make sure that such
+ a value is representable in an int (see its use below). */
+ if (spec.prec < 0)
spec.prec = -1;
}
else
- spec.prec = -1;
+ spec.prec = -1; /* missing precision */
MPFR_ASSERTD (spec.prec >= -1);
fmt = parse_arg_type (fmt, &spec);
diff --git a/Build/source/libs/mpfr/mpfr-src/src/version.c b/Build/source/libs/mpfr/mpfr-src/src/version.c
index f365a79f85e..25d88f71839 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/version.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/version.c
@@ -1,6 +1,6 @@
/* mpfr_get_version -- MPFR version
-Copyright 2004-2022 Free Software Foundation, Inc.
+Copyright 2004-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -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.1.1";
+ return "4.2.0";
}
diff --git a/Build/source/libs/mpfr/mpfr-src/src/volatile.c b/Build/source/libs/mpfr/mpfr-src/src/volatile.c
index 4c1727e9e76..00e3d341c13 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/volatile.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/volatile.c
@@ -4,7 +4,7 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE MPFR RELEASES.
-Copyright 2003-2004, 2006-2022 Free Software Foundation, Inc.
+Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h
index 4993117a74b..5d12477ac7a 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/x86/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h
index 6e9568c3ea4..4256194f2f8 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/x86_64/core2/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/x86_64/mparam.h b/Build/source/libs/mpfr/mpfr-src/src/x86_64/mparam.h
index ff162ef30ce..262bc483063 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/x86_64/mparam.h
+++ b/Build/source/libs/mpfr/mpfr-src/src/x86_64/mparam.h
@@ -1,6 +1,6 @@
/* Various Thresholds of MPFR, not exported. -*- mode: C -*-
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/src/yn.c b/Build/source/libs/mpfr/mpfr-src/src/yn.c
index 546c7aef1cd..c4d48668107 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/yn.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/yn.c
@@ -1,7 +1,7 @@
/* mpfr_y0, mpfr_y1, mpfr_yn -- Bessel functions of 2nd kind, integer order.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/y0.html
-Copyright 2007-2022 Free Software Foundation, Inc.
+Copyright 2007-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -324,12 +324,13 @@ mpfr_yn (mpfr_ptr res, long n, mpfr_srcptr z, mpfr_rnd_t r)
mpfr_t y, s1, s2, s3;
MPFR_ZIV_DECL (loop);
- mpfr_init (y);
- mpfr_init (s1);
- mpfr_init (s2);
- mpfr_init (s3);
-
prec = MPFR_PREC(res) + 2 * MPFR_INT_CEIL_LOG2 (MPFR_PREC (res)) + 13;
+
+ mpfr_init2 (y, prec);
+ mpfr_init2 (s1, prec);
+ mpfr_init2 (s2, prec);
+ mpfr_init2 (s3, prec);
+
MPFR_ZIV_INIT (loop, prec);
for (;;)
{
diff --git a/Build/source/libs/mpfr/mpfr-src/src/zeta.c b/Build/source/libs/mpfr/mpfr-src/src/zeta.c
index 65a5cbdcd80..18c7e179f29 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/zeta.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/zeta.c
@@ -1,6 +1,6 @@
/* mpfr_zeta -- compute the Riemann Zeta function
-Copyright 2003-2022 Free Software Foundation, Inc.
+Copyright 2003-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
@@ -300,12 +300,16 @@ mpfr_zeta_pos (mpfr_ptr z, mpfr_srcptr s, mpfr_rnd_t rnd_mode)
return inex;
}
+/* TODO: Check the error analysis. The following (undocumented?) one
+ does not take into account the replacement of sin(Pi*s/2) by sinpi(s/2)
+ in commit fd5d811d81f6d1839d4099cc1bb2cde705981648, which could have
+ reduced the error bound since the multiplication by Pi is now exact. */
/* return add = 1 + floor(log(c^3*(13+m1))/log(2))
where c = (1+eps)*(1+eps*max(8,m1)),
m1 = 1 + max(1/eps,2*sd)*(1+eps),
eps = 2^(-precz-14)
sd = abs(s-1)
- */
+*/
static long
compute_add (mpfr_srcptr s, mpfr_prec_t precz)
{
@@ -520,7 +524,7 @@ mpfr_zeta (mpfr_ptr z, mpfr_srcptr s, mpfr_rnd_t rnd_mode)
}
/* Check for case s=1 before changing the exponent range */
- if (mpfr_cmp (s, __gmpfr_one) == 0)
+ if (mpfr_equal_p (s, __gmpfr_one))
{
MPFR_SET_INF (z);
MPFR_SET_POS (z);
@@ -562,7 +566,6 @@ mpfr_zeta (mpfr_ptr z, mpfr_srcptr s, mpfr_rnd_t rnd_mode)
MPFR_ZIV_INIT (loop, prec1);
for (;;)
{
- mpfr_exp_t ey;
mpfr_t z_up;
mpfr_const_pi (p, MPFR_RNDD); /* p is Pi */
@@ -614,7 +617,7 @@ mpfr_zeta (mpfr_ptr z, mpfr_srcptr s, mpfr_rnd_t rnd_mode)
/* Note: it might be that EXP(z_down) = emax here, in that
case we will have overflow below when we multiply by 2 */
mpfr_prec_round (z_up, precz, rnd_mode);
- ok = mpfr_cmp (z_down, z_up) == 0;
+ ok = mpfr_equal_p (z_down, z_up);
mpfr_clear (z_up);
mpfr_clear (z_down);
if (ok)
@@ -642,27 +645,23 @@ mpfr_zeta (mpfr_ptr z, mpfr_srcptr s, mpfr_rnd_t rnd_mode)
mpfr_mul_2ui (z_pre, z_pre, 1, MPFR_RNDN);
/* multiply z_pre by sin(Pi*s/2) */
- mpfr_mul (y, s, p, MPFR_RNDN);
- mpfr_div_2ui (p, y, 1, MPFR_RNDN); /* p = s*Pi/2 */
- /* FIXME: sinpi will be available, we should replace the mpfr_sin
- call below by mpfr_sinpi(s/2), where s/2 will be exact.
- Can mpfr_sin underflow? Moreover, the code below should be
- improved so that the "if" condition becomes unlikely, e.g.
- by taking a slightly larger working precision. */
- mpfr_sin (y, p, MPFR_RNDN); /* y = sin(Pi*s/2) */
- ey = MPFR_GET_EXP (y);
- if (ey < 0) /* take account of cancellation in sin(p) */
- {
- mpfr_t t;
-
- MPFR_ASSERTN (- ey < MPFR_PREC_MAX - prec1);
- mpfr_init2 (t, prec1 - ey);
- mpfr_const_pi (t, MPFR_RNDD);
- mpfr_mul (t, s, t, MPFR_RNDN);
- mpfr_div_2ui (t, t, 1, MPFR_RNDN);
- mpfr_sin (y, t, MPFR_RNDN);
- mpfr_clear (t);
- }
+ mpfr_div_2ui (p, s, 1, MPFR_RNDN); /* p = s/2 */
+ /* Can mpfr_sinpi underflow? While with mpfr_sin, we could not
+ answer in any precision without a theoretical study (though
+ an underflow would have been very unlikely as we have a
+ huge exponent range), with mpfr_sinpi, an underflow could
+ occur only in a huge, unsupported precision. Indeed, if
+ mpfr_sinpi underflows, this means that 0 < |sinpi(s/2)| < m,
+ where m is the minimum representable positive number, and in
+ this case, r being the reduced argument such that |r| <= 1/2,
+ one has |sinpi(r)| > |2r|, so that |2r| < m; this can be
+ possible only if |s/2| > 1/2 (otherwise |s| = |2r| < m and
+ s would not be representable as an MPFR number) and s has
+ non-zero bits of exponent less than the minimum exponent
+ (s/2 - r being an integer), i.e. the precision is at least
+ MPFR_EMAX_MAX + 2. With such a huge precision, there would
+ probably be failures before reaching this point. */
+ mpfr_sinpi (y, p, MPFR_RNDN); /* y = sin(Pi*s/2) */
mpfr_mul (z_pre, z_pre, y, MPFR_RNDN);
if (MPFR_LIKELY (MPFR_CAN_ROUND (z_pre, prec1 - add, precz,
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 24dd9a5211f..dcbb49f2d8b 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/zeta_ui.c
@@ -1,6 +1,6 @@
/* mpfr_zeta_ui -- compute the Riemann Zeta function for integer argument.
-Copyright 2005-2022 Free Software Foundation, Inc.
+Copyright 2005-2023 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
diff --git a/Build/source/libs/mpfr/mpfr-src/version-ext.sh b/Build/source/libs/mpfr/mpfr-src/version-ext.sh
index 936092123cd..9bcc1298907 100644
--- a/Build/source/libs/mpfr/mpfr-src/version-ext.sh
+++ b/Build/source/libs/mpfr/mpfr-src/version-ext.sh
@@ -4,7 +4,8 @@
# Git working tree (Git branch or "(none)", total commit count,
# commit id, and whether the current HEAD is modified). It is
# called in tests/Makefile.am for "make check", but may be used
-# by other tools that need such information.
+# by other tools that need such information (other tests may be
+# needed; see tests/Makefile.am as an example of use).
# Note that this does not replace version information found in
# the VERSION file, which may still need to be output in addition
# to the output of this script.
@@ -20,6 +21,15 @@ fi
GREP=${GREP:-grep}
SED=${SED:-sed}
+# Note: for the branch detection, in the case of a detached HEAD state,
+# the commit may appear in multiple branches, i.e. which diverge after
+# the commit; thus we exclude branches created after this commit, based
+# on <branch>-root tags (such a tag should be added by the user when
+# creating a branch, so that "git diff <branch>-root" shows commits done
+# in the branch since its creation, etc.). If $gitb contains multiple
+# branches, this means that something is probably wrong with the tags
+# or the branches (merged branches should be deleted).
+
git tag --contains | $SED -n 's/-root$//p' > excluded-branches
gitb=`git branch --format='%(refname:short)' --contains | \
$SED 's,(HEAD detached at origin/\(.*\)),\1,' | \
diff --git a/Build/source/libs/mpfr/version.ac b/Build/source/libs/mpfr/version.ac
index 46fa926a69f..79421eed728 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.1.1])
+m4_define([mpfr_version], [4.2.0])