|
From: P.Lane <kc...@gm...> - 2005-08-14 04:34:48
|
Hello, I am new to programming and to c++ and Dev-CPP. I have been
experimenting with numbers and can't figure this one out. Here is the
code the I am using:
#include<iostream>
using namespace std;
int main ()
{
int a;
float b;
double c;
long double d;
cout << " Enter a number: ";
cin >> d;
c=3Dd;
b=3Dd;
a=3Dd;
cout << d << endl << c << endl << b << endl << a << endl;
return 0;
}
Here is the result with the number 123456789.123456789:
1.23457e+008
1.23457e+008
1.23457e+008
123456789
Now from what I have read, a long double should be good up to 19
digits, a long up to 15, and a float up to 7. Why does the long double
return 1.23457e+008, instead of the entered value of
123456789.123456789, which is only 18 digits long?
--=20
Paul Lane
KC9EYE
---------------------------------------------------------------------------=
--
"Life after all, is a fatal disease, and the mortality rate=20
for humans, at the end of the day is 100%."
K.C. Cole
---------------------------------------------------------------------------=
-
|