Skip to content

Commit 057d57f

Browse files
anun333claude
andcommitted
CORE-MATH ea7a421: log2.c, sinh.c, tanpi.c (on 81a899d's nine)
Upstream 10-12: sinh restores int64_t for ml (81a899d had narrowed it to int), a log2 patch, and a tanpi change. Old (040ee48, main) against new in all four rounding modes: the same results and flags on 686,469,600 calls on x86-64 (cfarm421) and aarch64 (cfarm424), with every input of the ten functions' worst-case files and its negative (1,922,435), control differs. 81a899d against ea7a421 is identical on the same calls: the narrowed ml cost time, not results. All carried files equal ea7a421 (harness/cm-diff/carried-identical.py in openpocl). Supersedes prep/cm-81a899d. For the next release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 71fe3bd commit 057d57f

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ The scalar functions, their tables, and the error analyses the vector paths
129129
rely on are [CORE-MATH](https://core-math.gitlabpages.inria.fr/)'s, by Alexei
130130
Sibidanov, Paul Zimmermann, Tom Hubrecht and others. Their files are
131131
included unmodified under their own MIT license and copyright notices. All
132-
165 are byte-identical to CORE-MATH's master branch at `81a899d`
133-
(2026-10-11). The
132+
165 are byte-identical to CORE-MATH's master branch at `ea7a421`
133+
(2026-10-12). The
134134
`crmvec-*-tab.h` headers copy their tables. Everything else is under the MIT
135135
license in `LICENSE`.
136136

‎log2.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,10 @@ static double __attribute__((noinline)) as_log2_refine(double x, double a){
302302
double v2, v0 = fasttwosum(L[0], sh, &v2), v1 = fasttwosum(v2, sl, &v2);
303303
t.f = v1;
304304
if(__builtin_expect(!(t.u&(~(u64)0>>12)), 0)){
305-
// even t and v2 are always of the same sign here, leave it aligned with other functions
305+
// even if t and v2 are always of the same sign here, leave it aligned with other functions
306306
b64u64_u w = {.f = v2};
307-
int d = ((int)((t.u^w.u)>>63))*2 + 1;
307+
int d = 1 - 2*(int)((t.u^w.u)>>63);
308+
// d=1 if t and v2 are of the same sign, d=-1 otherwise
308309
t.u += d;
309310
v1 = t.f;
310311
}

‎sinh.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ double cr_sinh(double x){
352352
// b64u64_u uh = {.f = th};
353353
b64u64_u ul = {.f = tl};
354354
// int64_t eh = (uh.u>>52)&0x7ff, el = (ul.u>>52)&0x7ff;
355-
int ml = (ul.u + 8)&(~0ul>>12);
355+
int64_t ml = (ul.u + 8)&(~0ul>>12);
356356
th += tl;
357357
th *= 2;
358358
th *= sp.f;

‎tanpi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static __attribute__((noinline)) double as_tanpi_database(double x, double f){
142142
uint64_t p = 0;
143143
double ax = __builtin_fabs(x);
144144
int32_t e = (aix>>52)-1022;
145-
if(e>=0){ // take into account periodic structure of tan
145+
if(e>=0){ // |x|>=0.5, take into account periodic structure of tan
146146
b64u64_u t = {.u = aix&~(~(uint64_t)0>>(12+e))};
147147
ax -= t.f;
148148
p = ((aix|(uint64_t)1<<52)>>(52-e))&1;

0 commit comments

Comments
 (0)