Skip to content

Commit b45f1f5

Browse files
committed
serfloat: do not test encode(bits)=bits anymore
1 parent bdddf36 commit b45f1f5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/test/serfloat_tests.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ BOOST_AUTO_TEST_CASE(double_serfloat_tests) {
4747
BOOST_CHECK_EQUAL(TestDouble(4.0), 0x4010000000000000ULL);
4848
BOOST_CHECK_EQUAL(TestDouble(785.066650390625), 0x4088888880000000ULL);
4949

50-
// Roundtrip test on IEC559-compatible systems
5150
if (std::numeric_limits<double>::is_iec559) {
5251
BOOST_CHECK_EQUAL(sizeof(double), 8U);
5352
BOOST_CHECK_EQUAL(sizeof(uint64_t), 8U);
@@ -64,8 +63,7 @@ BOOST_AUTO_TEST_CASE(double_serfloat_tests) {
6463
TestDouble(-std::numeric_limits<double>::signaling_NaN());
6564
TestDouble(std::numeric_limits<double>::denorm_min());
6665
TestDouble(-std::numeric_limits<double>::denorm_min());
67-
// Test exact encoding: on currently supported platforms, EncodeDouble
68-
// should produce exactly the same as the in-memory representation for non-NaN.
66+
// On IEC559-compatible systems, construct doubles to test from the encoding.
6967
for (int j = 0; j < 1000; ++j) {
7068
// Iterate over 9 specific bits exhaustively; the others are chosen randomly.
7169
// These specific bits are the sign bit, and the 2 top and bottom bits of
@@ -92,8 +90,7 @@ BOOST_AUTO_TEST_CASE(double_serfloat_tests) {
9290
if (x & 256) v |= (uint64_t{1} << 63);
9391
double f;
9492
memcpy(&f, &v, 8);
95-
uint64_t v2 = TestDouble(f);
96-
if (!std::isnan(f)) BOOST_CHECK_EQUAL(v, v2);
93+
TestDouble(f);
9794
}
9895
}
9996
}

0 commit comments

Comments
 (0)