mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 13:25:41 +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:
@@ -239,13 +239,13 @@ std::string StringMaker<unsigned char>::convert(unsigned char value) {
|
||||
return ::Catch::Detail::stringify(static_cast<char>(value));
|
||||
}
|
||||
|
||||
int StringMaker<float>::precision = 5;
|
||||
int StringMaker<float>::precision = std::numeric_limits<float>::max_digits10;
|
||||
|
||||
std::string StringMaker<float>::convert(float value) {
|
||||
return Detail::fpToString(value, precision) + 'f';
|
||||
}
|
||||
|
||||
int StringMaker<double>::precision = 10;
|
||||
int StringMaker<double>::precision = std::numeric_limits<double>::max_digits10;
|
||||
|
||||
std::string StringMaker<double>::convert(double value) {
|
||||
return Detail::fpToString(value, precision);
|
||||
|
Reference in New Issue
Block a user