Consider the following test case: #include <iostream> #include <iomanip> int main() { double pi = 3.14159; std::cout << std::setprecision(40) << pi << std::endl; } Compiling and running this program gives the output: 3.1415899999999999 We've got 16 digits after the decimal point, even though we've requested 40. There's code in locale_facets.tcc that limits the precision if it's "out of range". I don't see any justification for doing that either in clause 22.2.2.2.2 of the C++ standard, which defines the behavior in terms of printf, or in clause 7.19.6.1 of the C standard, which describes printf itself. (FWIW the C standard does say that there is an implementation defined upper limit for printf conversions, but it is required to be at least 4095.)
*** This bug has been marked as a duplicate of 14220 ***