5 ms·
The C++ code could use std::numeric_limits<double>:: max_digits10 instead of the magical 17!
The C++ code could use std::numeric_limits<double>:: max_digits10 instead of the magical 17!
That reads like the code equivalent of involuntarily burping in polite company.
Similarly, for C it could be:
printf("%.*f\n", DBL_DECIMAL_DIG, .1+.2)
In both cases, support for a relatively new language standard (C++11, C11) would be required.
2011 was six years ago.
Hence the phrase "relatively new".
In terms of C and C++, that's fairly new. Lots of older code using pre-C11/C++11 standards is out there.