negative precision values in ostream

Posted by daz-fuller on Stack Overflow See other posts from Stack Overflow or by daz-fuller
Published on 2009-12-24T09:24:17Z Indexed on 2010/04/08 9:53 UTC
Read the original article Hit count: 315

Filed under:
|
|
|

This is more of a question of curiosity but does anyone know how negative precision values are handled in C++? For example:

double pi = 3.14159265;

cout.precision(-10);
cout.setf(ios::fixed, ios::floatfield);

cout << pi << endl;

I've tried this out and using GCC and it seems that the precision value is ignored but I was curious if there is some official line on what happens in this situation.

© Stack Overflow or respective owner

Related posts about c++

Related posts about streams