[Bug 272539] cospi, sinpi and tanpi incorrectly test for NaN and Infinity
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 17 Jul 2023 04:11:31 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272539 Steve Kargl <kargl@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl@FreeBSD.org --- Comment #1 from Steve Kargl <kargl@FreeBSD.org> --- All, as the author of the code in question, Paul contacted me directly (which is fine!). I concur with his analysis. Here's a diff with the suggested changes. diff --git a/lib/msun/src/s_cospi.c b/lib/msun/src/s_cospi.c index 860219efd3e4..10e34e0d3e58 100644 --- a/lib/msun/src/s_cospi.c +++ b/lib/msun/src/s_cospi.c @@ -138,7 +138,7 @@ cospi(double x) return (j0 & 1 ? -c : c); } - if (ix >= 0x7f800000) + if (ix >= 0x7ff00000) return (vzero / vzero); /* diff --git a/lib/msun/src/s_sinpi.c b/lib/msun/src/s_sinpi.c index 858459a5fcb4..a114229d6df7 100644 --- a/lib/msun/src/s_sinpi.c +++ b/lib/msun/src/s_sinpi.c @@ -155,7 +155,7 @@ sinpi(double x) return ((hx & 0x80000000) ? -s : s); } - if (ix >= 0x7f800000) + if (ix >= 0x7ff00000) return (vzero / vzero); /* diff --git a/lib/msun/src/s_tanpi.c b/lib/msun/src/s_tanpi.c index 01d4c74367fd..f911d56156b3 100644 --- a/lib/msun/src/s_tanpi.c +++ b/lib/msun/src/s_tanpi.c @@ -163,7 +163,7 @@ tanpi(double x) } /* x = +-inf or nan. */ - if (ix >= 0x7f800000) + if (ix >= 0x7ff00000) return (vzero / vzero); /* -- You are receiving this mail because: You are the assignee for the bug.