[libc-commits] [libc] [libc][math] Fix FP add/sub for signed-zero operands (PR #183243)
via libc-commits
libc-commits at lists.llvm.org
Fri Feb 27 09:00:35 PST 2026
================
@@ -165,6 +165,13 @@ 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(zero, func(in.zero, in.zero));
+ EXPECT_FP_EQ(zero, func(in.neg_zero, in.zero));
+ EXPECT_FP_EQ(zero, func(in.zero, in.neg_zero));
+ EXPECT_FP_EQ(neg_zero, func(in.neg_zero, in.neg_zero));
----------------
lntue wrote:
Thanks for adding these! Can you also test for the same inputs with other rounding modes?
https://github.com/llvm/llvm-project/pull/183243
More information about the libc-commits
mailing list