Thursday, December 2, 2010

Default cout Number Precision

Without setting the precision with setprecision(...), the number 12345.12345 is printed to cout as 12345.1, 123456.123450, and 1.234512e+4 if nothing, 'fixed', and 'scientific', respectively, were previously inserted into cout.

The default is printing a total 6 digits, if possible. For fixed and scientific, the default number of digits after the decimal point is 6.

No comments:

Post a Comment