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