P
Piotr B.
Hello,
I use MingGW g++ 3.2.3 on Windows 2000/AMD Athlon XP.
I tried to output a "long double" variable using stdio printf().
I've tried various %formats (%llf, %Lf etc.), but none of them worked...
The same source compiled with Borland C++Builder 5.0
works for %Lf format.
How to get the same results with MinGW g++ ?
#include <stdio.h>
int main()
{
long double x = 1.5;
printf("%llf %llf %llf %llf\n", x, x, x, x);
printf("%Lf %Lf %Lf %Lf\n", x, x, x, x);
printf ("%Le %LE %Lf %LF %Lg %LG\n", x, x, x, x, x, x);
return 0;
/*
MinGW g++ 3.2.3 output (all wrong):
-2.000000 0.000000 0.000000 -2.000000
-2.000000 0.000000 0.000000 -2.000000
-2.000000e+000 8.094277E-320 0.000000 -2 8.09428E-320
Borland C++Builder 5.0 output (%Lf works):
-2.000000 0.000000 0.000000 -2.000000
1.500000 1.500000 1.500000 1.500000
1.500000e+00 1.500000E+00 1.500000 %LF %Lg %LG
*/
}
I use MingGW g++ 3.2.3 on Windows 2000/AMD Athlon XP.
I tried to output a "long double" variable using stdio printf().
I've tried various %formats (%llf, %Lf etc.), but none of them worked...
The same source compiled with Borland C++Builder 5.0
works for %Lf format.
How to get the same results with MinGW g++ ?
#include <stdio.h>
int main()
{
long double x = 1.5;
printf("%llf %llf %llf %llf\n", x, x, x, x);
printf("%Lf %Lf %Lf %Lf\n", x, x, x, x);
printf ("%Le %LE %Lf %LF %Lg %LG\n", x, x, x, x, x, x);
return 0;
/*
MinGW g++ 3.2.3 output (all wrong):
-2.000000 0.000000 0.000000 -2.000000
-2.000000 0.000000 0.000000 -2.000000
-2.000000e+000 8.094277E-320 0.000000 -2 8.09428E-320
Borland C++Builder 5.0 output (%Lf works):
-2.000000 0.000000 0.000000 -2.000000
1.500000 1.500000 1.500000 1.500000
1.500000e+00 1.500000E+00 1.500000 %LF %Lg %LG
*/
}