W
Wing
Hello everyone,
I have the following code:
///////////////////////////////////////
double num;
num=1234567890;
num+=(1.0/3.0);
cout.setf(ios::fixed);
cout<<setprecision(10);
cout<<num<<endl;
///////////////////////////////////////
The output is 1234567890.3333332539. I am wondering why the floating
numbers are not all "3". Why "2539" appears in the output?
Can anyone help me to solve this problem? Thank for so much.
I have the following code:
///////////////////////////////////////
double num;
num=1234567890;
num+=(1.0/3.0);
cout.setf(ios::fixed);
cout<<setprecision(10);
cout<<num<<endl;
///////////////////////////////////////
The output is 1234567890.3333332539. I am wondering why the floating
numbers are not all "3". Why "2539" appears in the output?
Can anyone help me to solve this problem? Thank for so much.