std::ios_base::precision
From cppreference.com
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.
The default precision, as established by std::basic_ios::init, is 6.
Contents |
[edit] Parameters
new_precision | - | new precision setting |
[edit] Return value
the precision before the call to the function
[edit] Example
Run this code
Output:
The default precision is 6 With default precision d is 1.23457 With high precision d is 1.23456789012
[edit] See also
manages field width (public member function) |