The format specification for floating points is the bitmax call std::ios_base::floatfield . In C ++ 03, it has two named settings ( std::ios_base::fixed and std::ios_base::scientific ). By default, none of these flags are set. This can be achieved, for example, using
stream.setf(std::ios_base::fmtflags(), std::ios_base::floatfield);
or
stream.unsetf(std::ios_base::floatfield);
(field type std::ios_base::fmtflags ).
With current C ++, there is also std::ios_base::hexfloat and two manipulators have been added, in particular std::defaultfloat() , which clears std::ios_base::floatfield :
stream << std::defaultfloat;
source share