[libc-commits] [libc] [libc][math] Fix range comments in exhaustive hypotf_test (PR #131769)

Tejas Vipin via libc-commits libc-commits at lists.llvm.org
Mon Mar 24 08:51:49 PDT 2025


https://github.com/meltq updated https://github.com/llvm/llvm-project/pull/131769

>From e1f6da016d3f716405b6589c1fa04f450388f7c1 Mon Sep 17 00:00:00 2001
From: meltq <alissxlace at proton.me>
Date: Tue, 18 Mar 2025 15:24:08 +0530
Subject: [PATCH 1/3] Fix STOP limit for x in exhaustive hypotf_test

---
 libc/test/src/math/exhaustive/hypotf_test.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/src/math/exhaustive/hypotf_test.cpp b/libc/test/src/math/exhaustive/hypotf_test.cpp
index 04da55d4d3a9f..601ec9f749462 100644
--- a/libc/test/src/math/exhaustive/hypotf_test.cpp
+++ b/libc/test/src/math/exhaustive/hypotf_test.cpp
@@ -53,7 +53,7 @@ using LlvmLibcHypotfExhaustiveTest = LlvmLibcExhaustiveMathTest<HypotfChecker>;
 
 // Range of the first input: [2^23, 2^24);
 static constexpr uint32_t START = (23U + 127U) << 23;
-static constexpr uint32_t STOP = ((23U + 127U) << 23) + 1;
+static constexpr uint32_t STOP = (24U + 127U) << 23;
 
 TEST_F(LlvmLibcHypotfExhaustiveTest, PositiveRange) {
   test_full_range_all_roundings(START, STOP);

>From 241ca8e18616f7d639fc3922892193c30e9e871a Mon Sep 17 00:00:00 2001
From: meltq <alissxlace at proton.me>
Date: Mon, 24 Mar 2025 19:06:22 +0530
Subject: [PATCH 2/3] Fix comments

---
 libc/test/src/math/exhaustive/hypotf_test.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/test/src/math/exhaustive/hypotf_test.cpp b/libc/test/src/math/exhaustive/hypotf_test.cpp
index 601ec9f749462..d61aee18cf236 100644
--- a/libc/test/src/math/exhaustive/hypotf_test.cpp
+++ b/libc/test/src/math/exhaustive/hypotf_test.cpp
@@ -21,7 +21,7 @@ struct HypotfChecker : public virtual LIBC_NAMESPACE::testing::Test {
   using StorageType = typename FPBits::StorageType;
 
   uint64_t check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding) {
-    // Range of the second input: [2^37, 2^48).
+    // Range of the second input: [2^37, 2^48].
     constexpr uint32_t Y_START = (37U + 127U) << 23;
     constexpr uint32_t Y_STOP = (48U + 127U) << 23;
 
@@ -51,9 +51,9 @@ struct HypotfChecker : public virtual LIBC_NAMESPACE::testing::Test {
 
 using LlvmLibcHypotfExhaustiveTest = LlvmLibcExhaustiveMathTest<HypotfChecker>;
 
-// Range of the first input: [2^23, 2^24);
+// Range of the first input: [2^23, 2^23 + 1];
 static constexpr uint32_t START = (23U + 127U) << 23;
-static constexpr uint32_t STOP = (24U + 127U) << 23;
+static constexpr uint32_t STOP = ((23U + 127U) << 23) + 1;
 
 TEST_F(LlvmLibcHypotfExhaustiveTest, PositiveRange) {
   test_full_range_all_roundings(START, STOP);

>From cae4d48edfa73cbd0593f03bd2c481132d67e0a7 Mon Sep 17 00:00:00 2001
From: meltq <alissxlace at proton.me>
Date: Mon, 24 Mar 2025 21:21:23 +0530
Subject: [PATCH 3/3] Changed to 2^24

---
 libc/test/src/math/exhaustive/hypotf_test.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/test/src/math/exhaustive/hypotf_test.cpp b/libc/test/src/math/exhaustive/hypotf_test.cpp
index d61aee18cf236..f4c63eadb42e9 100644
--- a/libc/test/src/math/exhaustive/hypotf_test.cpp
+++ b/libc/test/src/math/exhaustive/hypotf_test.cpp
@@ -51,9 +51,9 @@ struct HypotfChecker : public virtual LIBC_NAMESPACE::testing::Test {
 
 using LlvmLibcHypotfExhaustiveTest = LlvmLibcExhaustiveMathTest<HypotfChecker>;
 
-// Range of the first input: [2^23, 2^23 + 1];
+// Range of the first input: [2^23, 2^24];
 static constexpr uint32_t START = (23U + 127U) << 23;
-static constexpr uint32_t STOP = ((23U + 127U) << 23) + 1;
+static constexpr uint32_t STOP = (24U + 127U) << 23;
 
 TEST_F(LlvmLibcHypotfExhaustiveTest, PositiveRange) {
   test_full_range_all_roundings(START, STOP);



More information about the libc-commits mailing list