perf(hex8): integrate reviewed common finite classifier and build ignores

This commit is contained in:
KOKO\Mimi
2026-10-14 18:30:06 +09:00
5 changed files with 77 additions and 9 deletions
@@ -144,6 +144,23 @@ double FromBits(const std::uint64_t bits) {
return result;
}
TEST(HighLowArithmetic, FiniteClassificationMatchesBinary64Boundaries) {
const auto check = [](const double value) {
const bool expected = std::isfinite(value);
EXPECT_EQ(IsFinite(HighLow{value, 0.0}), expected);
EXPECT_EQ(IsFinite(HighLow{1.0, value}), expected);
};
for (std::uint64_t exponent = 0; exponent < 2048U; ++exponent) {
for (const auto fraction : {0ULL, 1ULL, 1ULL << 51U,
(1ULL << 52U) - 1ULL}) {
for (const auto sign : {0ULL, 1ULL << 63U})
check(FromBits(sign | (exponent << 52U) | fraction));
}
}
std::mt19937_64 random{0x5800f17U};
for (int sample = 0; sample < 10000; ++sample) check(FromBits(random()));
}
void ExpectSamePair(const HighLow actual,
const fesa::high_low_original::HighLow expected) {
EXPECT_EQ(Bits(actual.high), Bits(expected.high));