From ccf41dbe28dac8749d5aad06fde37467192cadb7 Mon Sep 17 00:00:00 2001 From: Dmitry Arkhipov Date: Sat, 26 Jun 2021 16:03:39 +0300 Subject: [PATCH] Fix tests failing for 32-bit targets --- test/value.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/value.cpp b/test/value.cpp index 9e650c040..131062324 100644 --- a/test/value.cpp +++ b/test/value.cpp @@ -1473,8 +1473,9 @@ class value_test THRO(std::uint16_t); EQUS(std::uint32_t); EQUS(std::uint64_t); - EQUF(float); EQAL(double); + // EQUF(float) will result in loss of precision, so the test might + // fail depending on compilation flags and target platform } { auto V = max_of(); @@ -1487,8 +1488,9 @@ class value_test THRO(std::uint16_t); THRO(std::uint32_t); EQUS(std::uint64_t); - EQUF(float); EQUF(double); + // EQUF(float) will result in loss of precision, so the test might + // fail depending on compilation flags and target platform } //--- { @@ -1647,6 +1649,19 @@ class value_test EQAL(float); EQAL(double); } + //--- + { + // fill with the number of ones equal to the size of float's + // mantissa; such a number can be converted to float without loss + // of precision + std::int64_t V = 1; + for( int i = 0; i <= std::numeric_limits::digits - 1; ++i ) + V *= 2; + --V; + + value const jv(V); + EQUF(float); + } error_code ec; value(nullptr).to_number(ec);