git: b14d94c27ce2 - stable/13 - libm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 23 Jul 2023 11:45:31 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=b14d94c27ce2d5ca47193d99db51f516e74c2f74

commit b14d94c27ce2d5ca47193d99db51f516e74c2f74
Author:     Steve Kargl <kargl@FreeBSD.org>
AuthorDate: 2023-07-17 05:19:28 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-07-23 11:44:24 +0000

    libm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()
    
    PR:     272539
    
    (cherry picked from commit be4c7f273508994638b68d2fae742be37d3cb117)
---
 lib/msun/src/s_cospi.c | 3 ++-
 lib/msun/src/s_sinpi.c | 3 ++-
 lib/msun/src/s_tanpi.c | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/msun/src/s_cospi.c b/lib/msun/src/s_cospi.c
index 860219efd3e4..2e2f92733a86 100644
--- a/lib/msun/src/s_cospi.c
+++ b/lib/msun/src/s_cospi.c
@@ -138,7 +138,8 @@ cospi(double x)
 		return (j0 & 1 ? -c : c);
 	}
 
-	if (ix >= 0x7f800000)
+	/* x = +-inf or nan. */
+	if (ix >= 0x7ff00000)
 		return (vzero / vzero);
 
 	/*
diff --git a/lib/msun/src/s_sinpi.c b/lib/msun/src/s_sinpi.c
index 858459a5fcb4..bc3759e567a3 100644
--- a/lib/msun/src/s_sinpi.c
+++ b/lib/msun/src/s_sinpi.c
@@ -155,7 +155,8 @@ sinpi(double x)
 		return ((hx & 0x80000000) ? -s : s);
 	}
 
-	if (ix >= 0x7f800000)
+	/* x = +-inf or nan. */
+	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);
 
 	/*