[libc-commits] [libc] [libc][math] Fix FP signed-zero add/sub for zero operands (PR #183243)

via libc-commits libc-commits at lists.llvm.org
Wed Feb 25 08:32:43 PST 2026


================
@@ -165,6 +165,10 @@ class AddTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     EXPECT_FP_EQ(OutType(-1.0), func(InType(-2.0), InType(1.0)));
     EXPECT_FP_EQ(OutType(-3.0), func(InType(-2.0), InType(-1.0)));
   }
+
+  void test_signed_zero_result(AddFunc func) {
+    EXPECT_FP_EQ(OutType(-0.0), func(InType(-0.0), InType(-0.0)));
----------------
lntue wrote:

Use `zero`, `neg_zero`, and `in.zero`, `in.neg_zero` constants.  Also can you add tests for all 4 choices for zeros in the inputs?

https://github.com/llvm/llvm-project/pull/183243


More information about the libc-commits mailing list