Re:0.30000000000000004
by santaclaus on Sunday April 02, 2017 @03:26PM
(#14018543)
The C++ code could use std::numeric_limits<double>:: max_digits10 instead of the magical 17!
[ Parent
| on HN ]
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.
In terms of C and C++, that's fairly new. Lots of older code using pre-C11/C++11 standards is out there.
Hence the phrase "relatively new".