git: d1d8c9114751 - stable/14 - libm: add parens to clarify expressions in fma, fmal

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 06 Aug 2024 20:44:09 UTC
The branch stable/14 has been updated by emaste:

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

commit d1d8c9114751ee481aa6ff980caa2640f8d6848d
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-06-18 01:30:44 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-08-06 19:39:52 +0000

    libm: add parens to clarify expressions in fma, fmal
    
    Obtained from:  NetBSD
    
    (cherry picked from commit 001606523a48ca2aa440c985db47327a00671358)
---
 lib/msun/src/s_fma.c  | 6 +++---
 lib/msun/src/s_fmal.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/msun/src/s_fma.c b/lib/msun/src/s_fma.c
index 16902d321290..6c889a6a46ca 100644
--- a/lib/msun/src/s_fma.c
+++ b/lib/msun/src/s_fma.c
@@ -222,17 +222,17 @@ fma(double x, double y, double z)
 		case FE_TONEAREST:
 			return (z);
 		case FE_TOWARDZERO:
-			if (x > 0.0 ^ y < 0.0 ^ z < 0.0)
+			if ((x > 0.0) ^ (y < 0.0) ^ (z < 0.0))
 				return (z);
 			else
 				return (nextafter(z, 0));
 		case FE_DOWNWARD:
-			if (x > 0.0 ^ y < 0.0)
+			if ((x > 0.0) ^ (y < 0.0))
 				return (z);
 			else
 				return (nextafter(z, -INFINITY));
 		default:	/* FE_UPWARD */
-			if (x > 0.0 ^ y < 0.0)
+			if ((x > 0.0) ^ (y < 0.0))
 				return (nextafter(z, INFINITY));
 			else
 				return (z);
diff --git a/lib/msun/src/s_fmal.c b/lib/msun/src/s_fmal.c
index 9d08bc72e12e..80c835d09c2b 100644
--- a/lib/msun/src/s_fmal.c
+++ b/lib/msun/src/s_fmal.c
@@ -203,17 +203,17 @@ fmal(long double x, long double y, long double z)
 		case FE_TONEAREST:
 			return (z);
 		case FE_TOWARDZERO:
-			if (x > 0.0 ^ y < 0.0 ^ z < 0.0)
+			if ((x > 0.0) ^ (y < 0.0) ^ (z < 0.0))
 				return (z);
 			else
 				return (nextafterl(z, 0));
 		case FE_DOWNWARD:
-			if (x > 0.0 ^ y < 0.0)
+			if ((x > 0.0) ^ (y < 0.0))
 				return (z);
 			else
 				return (nextafterl(z, -INFINITY));
 		default:	/* FE_UPWARD */
-			if (x > 0.0 ^ y < 0.0)
+			if ((x > 0.0) ^ (y < 0.0))
 				return (nextafterl(z, INFINITY));
 			else
 				return (z);