This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
gcc compilation on amd opteron and precision
- From: "Muge Unel" <m dot unel1 at physics dot ox dot ac dot uk>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Sat, 7 May 2005 13:13:57 +0100
- Subject: gcc compilation on amd opteron and precision
HI gcc-guru's,
I have a question:
i am having my first compiling experiences on an opteron machine+64bit
arch and testing various compilers and options.
This is on
RH ES x86_64 x86_64 x86_64 GNU/Linux AMD Opteron Processor 248, using
"/usr/bin/gcc -O3" with either an -m32 or -m64 option.
My main concern is how to obtain the maximum precision from the
architecture, expecially 128-bit quad. precision.
The first thing i checked is the sizes of data types.
I think i get the correct behaviour for that:
for example, 16B with 64bit compilation and 12B for 32, for a long
double size.
however, the results of my simple calculations do not seem to make
sense.
for example, code fragments like:
printf ("for a long double \n");
p= (long double) 1.0 / (long double) 3.0;
q = (long double) p * (long double) 3.0 - (long double) 1.0;
printf ("1 /3 is: %.30e\n", p);
printf ("(1 / 3) x 3 - 1 is: %.30e\n", q);
give me:
-m32:
for a float
1 / 3 is: 3.333333432674407958984375000000e-01 vs 3.3
(1 / 3) x 3 - 1 is: 0.000000000000000000000000000000e+00 vs 0.0
for a double
1 / 3 is: 3.333333333333333148296162562474e-01
(1 / 3) x 3 - 1 is: 0.000000000000000000000000000000e+00
for a long double
1 /3 is: -3.720662080996989039630925438211e-103
(1 / 3) x 3 - 1 is: 0.000000000000000000000000000000e+00
-m64:
for a float
1 / 3 is: 3.333333432674407958984375000000e-01 vs 3.3
(1 / 3) x 3 - 1 is: 0.000000000000000000000000000000e+00 vs 0.0
for a double
1 / 3 is: 3.333333333333333148296162562474e-01
(1 / 3) x 3 - 1 is: 0.000000000000000000000000000000e+00
for a long double
1 /3 is: 0.000000000000000000000000000000e+00
(1 / 3) x 3 - 1 is: 0.000000000000000000000000000000e+00
could you give me some insight? what i may be doing wrong? what should i
do (for. ex, which options?) should i use to get quadrupole precision?
Thanks a lot for any help!
Best,
Muge