mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 22:05:39 +02:00
Default StringMaker<FloatingPointType>::precision to max_digits10
`max_digits10` is the number of decimal digits that the type _can_ represent, in other words, the number of decimal digits needed to disambiguate any two floating point numbers when serialized to a string.
This commit is contained in:
@@ -124,8 +124,8 @@ TEST_CASE("Precision of floating point stringification can be set", "[toString][
|
||||
const auto oldPrecision = sm::precision;
|
||||
|
||||
const float testFloat = 1.12345678901234567899f;
|
||||
auto str1 = sm::convert(testFloat);
|
||||
sm::precision = 5;
|
||||
auto str1 = sm::convert( testFloat );
|
||||
// "1." prefix = 2 chars, f suffix is another char
|
||||
CHECK(str1.size() == 3 + 5);
|
||||
|
||||
|
Reference in New Issue
Block a user