Skip to content

Commit 1f96788

Browse files
authored
[libc][math] Fix range and comments in exhaustive hypotf_test (#131769)
`((23U + 127U) << 23) + 1` evaluates to `(2^23)+1` as opposed to `2^24`, so should instead be `(24U + 127U) << 23`. Additionally, range for both inputs is inclusive of STOP. The comments have been updated reflecting these changes.
1 parent 9c6abf0 commit 1f96788

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: libc/test/src/math/exhaustive/hypotf_test.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct HypotfChecker : public virtual LIBC_NAMESPACE::testing::Test {
2121
using StorageType = typename FPBits::StorageType;
2222

2323
uint64_t check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding) {
24-
// Range of the second input: [2^37, 2^48).
24+
// Range of the second input: [2^37, 2^48].
2525
constexpr uint32_t Y_START = (37U + 127U) << 23;
2626
constexpr uint32_t Y_STOP = (48U + 127U) << 23;
2727

@@ -51,9 +51,9 @@ struct HypotfChecker : public virtual LIBC_NAMESPACE::testing::Test {
5151

5252
using LlvmLibcHypotfExhaustiveTest = LlvmLibcExhaustiveMathTest<HypotfChecker>;
5353

54-
// Range of the first input: [2^23, 2^24);
54+
// Range of the first input: [2^23, 2^24];
5555
static constexpr uint32_t START = (23U + 127U) << 23;
56-
static constexpr uint32_t STOP = ((23U + 127U) << 23) + 1;
56+
static constexpr uint32_t STOP = (24U + 127U) << 23;
5757

5858
TEST_F(LlvmLibcHypotfExhaustiveTest, PositiveRange) {
5959
test_full_range_all_roundings(START, STOP);

0 commit comments

Comments
 (0)