Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 2023 04:11:31 +0000
From:      bugzilla-noreply@freebsd.org
To:        numerics@FreeBSD.org
Subject:   [Bug 272539] cospi, sinpi and tanpi incorrectly test for NaN and Infinity
Message-ID:  <bug-272539-18636-fT3GmOxz7q@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-272539-18636@https.bugs.freebsd.org/bugzilla/>
References:  <bug-272539-18636@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help

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.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-272539-18636-fT3GmOxz7q>