[libc-commits] [libc] [libc][math] Fix STOP limit for x in exhaustive hypotf_test (PR #131769)

via libc-commits libc-commits at lists.llvm.org
Tue Mar 18 03:01:38 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Tejas Vipin (meltq)

<details>
<summary>Changes</summary>

`((23U + 127U) << 23) + 1` evaluates to `(2^23)+1` as opposed to `2^24`. This is also noticeable when running the test itself, which prints
```
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcHypotfExhaustiveTest.PositiveRange
-- Testing for FE_TONEAREST in range [0x4b000000, 0x4b000001) --
```

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


1 Files Affected:

- (modified) libc/test/src/math/exhaustive/hypotf_test.cpp (+1-1) 


``````````diff
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);

``````````

</details>


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


More information about the libc-commits mailing list