high-precision output to be done with max_digits10
The following discussion from !5065 (merged) should be addressed:
-
@chleh started a discussion: (+1 comment) Why precision of 18 digits?
Better use https://en.cppreference.com/w/cpp/types/numeric_limits/max_digits10?
The value of std::numeric_limits::max_digits10 is the number of base-10 digits that are necessary to uniquely represent all distinct values of the type T, such as necessary for serialization/deserialization to text. [...] the conversion of a floating-point value to text and back is exact as long as at least max_digits10 were used (9 for float, 17 for double): it is guaranteed to produce the same floating-point value, even though the intermediate text representation is not exact.