I got some problem with c++ rounding my numbers...
My code is :
double w, semiw;
cin >> w;
semiw = w / 2.0;
cout << "w : " << w << "; semiw : " << semiw << endl;
which, when given the console input 19.9999998
returns :
w : 20; semiw : 10
and not
w : 19.9999998; semiw : 9.9999999
as one could expect. I'd like to keep the precision double
is supposed to provide, which is, according to this page, 15 significant digits. How can I achieve that ? Thanks in advance for the answers :)