Using "long double" with gcc
#include <stdio.h>
int main()
{
long double a, b, c;
b = 1./7.;
c = 7.;
a = 1./c;
printf("%.30e \n", a);
printf("%.30e \n", b);
printf("%.30e \n", c);
return 0;
}
But the program returns garbage when compiled and run with:
%gcc top2.c -o test
%./test
-1.391130315222827826529386765980e-220
-1.391130315222712834096824073018e-220
-2.681561585988519419914804999641e+154
(XCode 3.1, gcc 4.0.1 or 4.2.1, Intel Xeon, 10.5.4)
The program works for double, however.
So what am I doing wrong?
Matthias
MacPro Quad-Core Xeon, MacBook Pro, Mac OS X (10.5.4)