[Trilinos-Users] Idempotent floating-point I/O?

Mark Hoemmen mhoemme at sandia.gov
Thu Apr 7 15:46:03 MDT 2011

On Apr 7, 2011, at 3:38 PM, Bartlett, Roscoe A wrote:
> Mark,
> I believe that this is controllable by the setup of the ostream object you are outputting to.  Just crank up the precision and you can get as many digits as you would like.  If you expect 16 significant digits, just print out something like 20 or whatever is needed to reproduce the same binary representation.

That works for Scalar=double, but not for double-double, quad-double, etc. Currently, you can't portably compute that using Teuchos::ScalarTraits with arbitrary Scalar type: you have to round up the result of STM::t() * log10 (STM::base()) for STM = Teuchos::ScalarTraits<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>, and STM doesn't have a log10 function.  

> However, it seems like the ParameterList class should just automatically print out floating point numbers in full precision does it not?

The above example suggests not.  Anyway, it's not a big deal.  Maybe I should just document this as a bug and deal with it when I have more time.


More information about the Trilinos-Users mailing list