Skip to content

Conversation

@krishna2803
Copy link
Contributor

No description provided.

@llvmbot llvmbot added the libc label Jul 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 29, 2025

@llvm/pr-subscribers-libc

Author: Krishna Pandey (krishna2803)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/151211.diff

1 Files Affected:

  • (modified) libc/test/src/__support/FPUtil/comparison_operations_test.cpp (+7-19)
diff --git a/libc/test/src/__support/FPUtil/comparison_operations_test.cpp b/libc/test/src/__support/FPUtil/comparison_operations_test.cpp
index 04a3321fd5dbf..5bb00f2016c67 100644
--- a/libc/test/src/__support/FPUtil/comparison_operations_test.cpp
+++ b/libc/test/src/__support/FPUtil/comparison_operations_test.cpp
@@ -25,27 +25,15 @@ template <typename T>
 class ComparisonOperationsTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
   DECLARE_SPECIAL_CONSTANTS(T)
 
-  // TODO: Make these constexpr once quick_get_round is made constexpr.
-  T normal1;
-  T neg_normal1;
-  T normal2;
-  T small;
-  T neg_small;
-  T large;
-  T neg_large;
+  static constexpr T normal1 = T(3.14);
+  static constexpr T neg_normal1 = T(-3.14);
+  static constexpr T normal2 = T(2.71);
+  static constexpr T small = T(0.1);
+  static constexpr T neg_small = T(-0.1);
+  static constexpr T large = T(10000.0);
+  static constexpr T neg_large = T(-10000.0);
 
 public:
-  void SetUp() override {
-    with_fenv_preserved([this]() {
-      normal1 = T(3.14);
-      neg_normal1 = T(-3.14);
-      normal2 = T(2.71);
-      small = T(0.1);
-      neg_small = T(-0.1);
-      large = T(10000.0);
-      neg_large = T(-10000.0);
-    });
-  }
 
   void test_equals() {
     EXPECT_TRUE(equals(neg_zero, neg_zero));

@krishna2803 krishna2803 changed the title [libc][math] Make Bfloat16 comparison tests constexpr [libc][math] Make BFloat16 comparison tests constexpr Jul 29, 2025
@github-actions
Copy link

github-actions bot commented Jul 29, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Signed-off-by: Krishna Pandey <[email protected]>
@lntue lntue merged commit 616cef0 into llvm:main Jul 29, 2025
19 checks passed
@krishna2803 krishna2803 deleted the constexpr-comp-op-tests branch July 29, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants