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

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


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

`((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) --
```

>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] 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);



More information about the libc-commits mailing list