gcc/libquadmath/math
Jakub Jelinek b498814668 libquadmath: Fix up THREEp96 constant in expq
Here is a cherry-pick from glibc [BZ #32411] fix.

As mentioned by the reporter in a pull request against gcc-mirror,
the THREEp96 constant in e_expl.c is incorrect, it is actually 0x3.p+94f128
rather than 0x3.p+96f128.

The algorithm uses that to compute the t2 integer (tval2), by whose
delta it adjusts the x+xl pair and then in the result uses the precomputed
exp value for that entry.
Using 0x3.p+94f128 rather than 0x3.p+96f128 results in tval2 sometimes
being one smaller, sometimes one larger than the desired value, thus can mean
the x+xl pair after adjustment will be larger in absolute value than it
should be.

DesWursters created a test program for this
https://github.com/DesWurstes/comparefloats
and his results were
total: 1135000000 not_equal: 4322 earlier_score: 674 later_score: 3648
I've modified this so with
https://sourceware.org/bugzilla/show_bug.cgi?id=32411#c3
so that it actually tests pseudo-random _Float128 values with range
(-16384.,16384) with strong bias on values larger than 0.0002 in absolute
value (so that tval1/tval2 aren't zero most of the time) and that gave
total: 10000000000 not_equal: 29861 earlier_score: 4606 later_score: 25255
So, in both cases, in most cases the change doesn't result in any differences,
and in those rare cases where does, about 85% have smaller ulp than without
the patch.
Additionally I've tried
https://sourceware.org/bugzilla/show_bug.cgi?id=32411#c4
and in 2 billion iterations it didn't find any case where x+xl after the
adjustments without this change would be smaller in absolute value compared
to x+xl after the adjustments with this change.

2025-04-09  Jakub Jelinek  <jakub@redhat.com>

	* math/expq.c (C): Fix up THREEp96 constant.

(cherry picked from commit e081ced345)
2025-04-23 10:01:19 +02:00
..
acoshq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
acosq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
asinhq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
asinq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
atan2q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
atanhq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
atanq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
cacoshq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
cacosq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
casinhq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
casinhq_kernel.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
casinq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
catanhq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
catanq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
cbrtq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
ccoshq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
ceilq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
cexpq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
cimagq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
clog10q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
clogq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
complex.c
conjq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
copysignq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
coshq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
cosq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
cosq_kernel.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
cprojq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
crealq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
csinhq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
csinq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
csqrtq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
ctanhq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
ctanq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
erfq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
exp2q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
expm1q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
expq.c libquadmath: Fix up THREEp96 constant in expq 2025-04-23 10:01:19 +02:00
expq_table.h Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
fabsq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
fdimq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
finiteq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
floorq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
fmaq.c Update libquadmath fmaq from glibc, fix nanq issues. 2018-11-07 13:49:03 +00:00
fmaxq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
fminq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
fmodq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
frexpq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
hypotq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
ilogbq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
isinfq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
isnanq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
issignalingq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
j0q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
j1q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
jnq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
ldexpq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
lgammaq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
lgammaq_neg.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
lgammaq_product.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
llrintq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
llroundq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
log1pq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
log2q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
log10q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
logbq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
logq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
lrintq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
lroundq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
modfq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
nanq.c Update libquadmath fmaq from glibc, fix nanq issues. 2018-11-07 13:49:03 +00:00
nearbyintq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
nextafterq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
powq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
rem_pio2q.c
remainderq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
remquoq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
rintq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
roundq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
scalblnq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
scalbnq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
signbitq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
sincos_table.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
sincosq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
sincosq_kernel.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
sinhq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
sinq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
sinq_kernel.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
sqrtq.c re PR libquadmath/81848 (Add PowerPC support to libquadmath) 2017-09-01 22:10:57 +00:00
tanhq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
tanq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
tanq_kernel.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
tgammaq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
tgammaq_product.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
truncq.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00
x2y2m1q.c Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686). 2018-11-05 23:03:55 +00:00