Namespaces
Variants
Views
Actions

Talk:cpp/io/manip/setprecision

From cppreference.com
< Talk:cpp‎ | io‎ | manip

What is the effect of setting precision to 0? Or to -1?

std::streamsize is signed, so the value 0 or -1 is stored in the stream object. As for what the standard library parsers and formatters do with it, see std::num_put::do_put, which sends off to std::printf, which explains its effects: zero specifies zero decimal digits and negative values are ignored, the default of 6 is used --Cubbi (talk) 15:17, 5 January 2016 (PST)