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:
Martin Hořeňovský
2024-04-30 16:43:05 +02:00
parent efb39689d9
commit ef713582d2
18 changed files with 2109 additions and 1071 deletions

View File

@@ -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);