T
tomrobin
Hi,
I'm having trouble with data types. I understand that the double data
type is 64-bit, which should correspond to 15 digits(?).
However, it seems from running this program that it can only handle up
to 6 digits:
#include <iostream>
using namespace std;
main () {
double w = 500 - 0.001;
cout << w << endl;
double x = 500 - 0.0001;
cout << x << endl;
system("PAUSE");
return 0;
}
since the output is:
500
499.99
Where am I going wrong?
Thanks for your help,
Tom
I'm having trouble with data types. I understand that the double data
type is 64-bit, which should correspond to 15 digits(?).
However, it seems from running this program that it can only handle up
to 6 digits:
#include <iostream>
using namespace std;
main () {
double w = 500 - 0.001;
cout << w << endl;
double x = 500 - 0.0001;
cout << x << endl;
system("PAUSE");
return 0;
}
since the output is:
500
499.99
Where am I going wrong?
Thanks for your help,
Tom