This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Precision
- From: Feodor Pisnitchenko <feodor at mat dot ufpr dot br>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 18 Dec 2003 21:11:52 -0200 (BRST)
- Subject: Precision
Hi all!
How can I find out the precision (mantissa length) of a floating point
number in i386 architecture?
I don't understand the output the following program (why long double and
double have the same mantissa length?)
#include <iostream>
using namespace std;
int main() {
float c3;
double c2;
long double c1;
c3=1.1234567890123456789012345678901234567890123456789012345678901234567890;
c2=1.1234567890123456789012345678901234567890123456789012345678901234567890;
c1=1.1234567890123456789012345678901234567890123456789012345678901234567890;
cout.precision(50);
cout << "long double c1 = " << c1 << " " << sizeof(c1) << endl;
cout << " double c2 = " << c2 << " " << sizeof(c2) << endl;
cout << " float c3 = " << c3 << " " << sizeof(c3) << endl;
}
output:
long double c1 = 1.1234567890123456912476740399142727255821228027344 12
double c2 = 1.1234567890123456912476740399142727255821228027344 8
float c3 = 1.12345683574676513671875 4