42 #ifndef TEUCHOS_SET_SCIENTIFIC_HPP
43 #define TEUCHOS_SET_SCIENTIFIC_HPP
72 template<typename Scalar, const bool isFloatingPoint = ! Teuchos::ScalarTraits<Scalar>::isOrdinal>
81 template<
typename Scalar>
88 originalFlags_(out.flags()),
89 originalPrecision_(out.precision())
92 out << std::scientific;
98 out.precision(static_cast<std::streamsize>(prec));
103 typedef typename STS::magnitudeType magnitude_type;
121 const magnitude_type numDecDigits = STM::t() * STM::log10 (STM::base());
126 const magnitude_type one = STM::one();
127 const magnitude_type two = one + one;
131 Teuchos::as<int>(magnitude_type((two*numDecDigits + one) / two));
136 out_.flags (originalFlags_);
151 template<
class Scalar>
161 #endif // TEUCHOS_SET_SCIENTIFIC_HPP
std::streamsize originalPrecision_
The output stream's original precision.
static int getDefaultPrecision()
Temporarily make an output stream use scientific notation with sufficient precision.
This structure defines some basic traits for a scalar field type.
std::ostream & out_
The output stream to which to apply flags.
SetScientific(std::ostream &)
SetScientific(std::ostream &out, int prec=-1)
std::ios_base::fmtflags originalFlags_
The output stream's original flags.
Defines basic traits for the scalar field type.
Definition of Teuchos::as, for conversions between types.