[clang] [llvm] Intrinsic: introduce minimumnum and maximumnum (PR #93841)
Joshua Cranmer via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 10:43:42 PDT 2024
================
@@ -631,6 +631,46 @@ TEST(APFloatTest, Maximum) {
EXPECT_TRUE(std::isnan(maximum(nan, f1).convertToDouble()));
}
+TEST(APFloatTest, MinimumNumber) {
+ APFloat f1(1.0);
+ APFloat f2(2.0);
+ APFloat zp(0.0);
+ APFloat zn(-0.0);
+ APFloat nan = APFloat::getNaN(APFloat::IEEEdouble());
+ APFloat snan = APFloat::getSNaN(APFloat::IEEEdouble());
+
+ EXPECT_EQ(1.0, minimumnum(f1, f2).convertToDouble());
+ EXPECT_EQ(1.0, minimumnum(f2, f1).convertToDouble());
+ EXPECT_EQ(-0.0, minimumnum(zp, zn).convertToDouble());
+ EXPECT_EQ(-0.0, minimumnum(zn, zp).convertToDouble());
----------------
jcranmer-intel wrote:
I don't think this is testing what you want to test, as `0.0 == -0.0`
https://github.com/llvm/llvm-project/pull/93841
More information about the llvm-commits
mailing list