Ich benutze die neuesten gcc mit Netbeans auf Windows. Warum funktioniert long double
nicht? Ist der printf
Spezifizierer %lf
falsch?printf und lange Doppel
Code:
#include <stdio.h>
int main(void)
{
float aboat = 32000.0;
double abet = 5.32e-5;
long double dip = 5.32e-5;
printf("%f can be written %e\n", aboat, aboat);
printf("%f can be written %e\n", abet, abet);
printf("%lf can be written %le\n", dip, dip);
return 0;
}
Ausgang:
32000.000000 can be written 3.200000e+004
0.000053 can be written 5.320000e-005
-1950228512509697500000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000.000000
can be written 2.725000e+002
Press [Enter] to close the terminal ...
http://bytes.com/topic/c/answers/135253-printing-long-double-type-via-printf-mingw-g-3-2-3-a – gameboy
offensichtlich ist es ein Problem mit MinGW und langem Doppel – gameboy
mögliches Duplikat von [kann ein langes Doppel in C nicht korrekt drucken] (http://stackoverflow.com/questions/26296058/cant-print-correctly-a-long-double-in-c) –