std::ios_base::precision (3) - Linux Manuals
std::ios_base::precision: std::ios_base::precision
NAME
std::ios_base::precision - std::ios_base::precision
Synopsis
streamsize precision() const; (1)
streamsize precision( streamsize new_precision ); (2)
Manages the precision (i.e. how many digits are generated) of floating point output performed by std::num_put::do_put.
1) Returns the current precision.
2) Sets the precision to the given one. Returns the previous precision.
The default precision, as established by std::basic_ios::init, is 6.
Parameters
new_precision - new precision setting
Return value
the precision before the call to the function
Example
// Run this code
Output:
See also
width (public member function)
setprecision (function)