git: 001606523a48 - main - libm: add parens to clarify expressions in fma, fmal

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 15 Jul 2024 13:31:33 UTC
The branch main has been updated by emaste:

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

commit 001606523a48ca2aa440c985db47327a00671358
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-06-18 01:30:44 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-07-15 13:30:02 +0000

    libm: add parens to clarify expressions in fma, fmal
    
    Obtained from:  NetBSD
---
 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);