@George_P Thanks a lot for excellent inputs on the topic, for which even books seems have nothing to impart.
Till now, got inputs from SO (
https://stackoverflow.com/q/554063/555045), about an alternative way:
- add in header:
(i) header file : #include <limits>
(ii) typedef std::numeric_limits< double > dbl
- in code, state:
cout.precision(dbl::max_digits10)
This works too, but surprisingly not stated here.
Request if there are gains in one approach over the other; & hence not stated by you?
Also, if outstream's precision is changed, then if store output in file, there the same change should occur too.
But, failed with the SO approach, stated here.
Haven't tried so far your method, but think it would also fail for output stored in file.
Will update soon.