If I input value: 3.123456789012345e-09
I should get back 3.12345678901235e-09
But it will only round up on .6 to .9
ostringstream os;
double d = 3.123456789012345e-09 ;
os << setprecision( 15 );
os << d;
istringstream is ( os.str() );
is >> setprecision( 15) >> d;
std::cout << d << std::endl;
The real bizzare thing is: The rounding behaviour changes depending on the power:
3.123456789012345e-09 = 3.12345678901234e-09
3.123456789012345e-10 = 3.12345678901234e-10
3.123456789012345e-11 = 3.12345678901235e-11
3.123456789012345e-14 = 3.12345678901235e-14
Every 1000th power rounds correctly... I am so confused. I know that rounding is a bit a of a weird subject but I cant make heads or tails of this. on a 64 bit machine btw.