1515
1616namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
1717
18- // Range of both inputs: [0, inf]
19- static constexpr uint16_t START = 0x0000U ;
20- static constexpr uint16_t STOP = 0x7C00U ;
21-
2218struct Hypotf16Checker : public virtual LIBC_NAMESPACE::testing::Test {
2319 using FloatType = float16;
2420 using FPBits = LIBC_NAMESPACE::fputil::FPBits<float16>;
2521 using StorageType = typename FPBits::StorageType;
2622
27- uint64_t check (uint16_t start, uint16_t stop, mpfr::RoundingMode rounding) {
23+ uint64_t check (uint16_t x_start, uint16_t x_stop, uint16_t y_start,
24+ uint16_t y_stop, mpfr::RoundingMode rounding) {
2825 mpfr::ForceRoundingMode r (rounding);
2926 if (!r.success )
3027 return true ;
31- uint16_t xbits = start ;
28+ uint16_t xbits = x_start ;
3229 uint64_t failed = 0 ;
3330 do {
3431 float16 x = FPBits (xbits).get_val ();
@@ -44,15 +41,27 @@ struct Hypotf16Checker : public virtual LIBC_NAMESPACE::testing::Test {
4441 // 0.5,
4542 // rounding);
4643 failed += (!correct);
47- } while (ybits++ < STOP );
48- } while (xbits++ < stop );
44+ } while (ybits++ < y_stop );
45+ } while (xbits++ < x_stop );
4946 return failed;
5047 }
5148};
5249
5350using LlvmLibcHypotf16ExhaustiveTest =
5451 LlvmLibcExhaustiveMathTest<Hypotf16Checker, 1 << 2 >;
5552
53+ // Range of both inputs: [0, inf]
54+ static constexpr uint16_t POS_START = 0x0000U ;
55+ static constexpr uint16_t POS_STOP = 0x7C00U ;
56+
5657TEST_F (LlvmLibcHypotf16ExhaustiveTest, PositiveRange) {
57- test_full_range_all_roundings (START, STOP);
58+ test_full_range_all_roundings (POS_START, POS_STOP, POS_START, POS_STOP);
59+ }
60+
61+ // Range of both inputs: [-0, -inf]
62+ static constexpr uint16_t NEG_START = 0x8000U ;
63+ static constexpr uint16_t NEG_STOP = 0xFC00U ;
64+
65+ TEST_F (LlvmLibcHypotf16ExhaustiveTest, NegativeRange) {
66+ test_full_range_all_roundings (NEG_START, NEG_STOP, NEG_START, NEG_STOP);
5867}
0 commit comments