Truncated floating point with C++ streams
Hello,
Can anyone please tell me the appropriate flag combination for formating truncated floating point values using C++ streams. I do not want any rounding.
Thanks 1*10^6 (thanks a million).
Chris.
Code example with questions within the comments:
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, char* argv[])
{
// Have nine nines.
double d = 0.999999999;
// Want eight nines but don't get it.
// How do I get the truncation?
// Is it possible using streams?
cout << std::setprecision(8) << std::fixed << d << endl;
return 1;
}
:)