Date: Thu, 16 Oct 2025 17:38:42 GMT From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 4c87cff1c8c5 - releng/15.0 - libm: remainder: make sure x is zero Message-ID: <202510161738.59GHcgUC032325@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=4c87cff1c8c53f06d8d25813fa32f1cc35657897 commit 4c87cff1c8c53f06d8d25813fa32f1cc35657897 Author: Ahmad Khalifa <vexeduxr@FreeBSD.org> AuthorDate: 2025-10-10 09:30:52 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2025-10-16 17:37:22 +0000 libm: remainder: make sure x is zero Make sure the entirety of x is zero before flipping the sign bit. Otherwise the sign would be wrong for small values of x when x is negative and |n*y| > |x| Approved by: re (cperciva) Reported by: alfredo PR: 251091 Reviewed by: kargl MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53023 (cherry picked from commit 25cca51ed294890d20a3c0290814cd26875db686) (cherry picked from commit 583e976d6d09770a6299a19603d4f0dbaa562cac) --- lib/msun/src/e_remainder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/msun/src/e_remainder.c b/lib/msun/src/e_remainder.c index a5fb7141d01a..cc6cd320073e 100644 --- a/lib/msun/src/e_remainder.c +++ b/lib/msun/src/e_remainder.c @@ -64,8 +64,8 @@ remainder(double x, double p) if(x>=p_half) x -= p; } } - GET_HIGH_WORD(hx,x); - if ((hx&0x7fffffff)==0) hx = 0; + EXTRACT_WORDS(hx, lx, x); + if (((hx&0x7fffffff)|lx) == 0) hx = 0; SET_HIGH_WORD(x,hx^sx); return x; }help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510161738.59GHcgUC032325>
