Conversion specifier of long double in C
From an old mingw wiki:
mingw uses the Microsoft C run-time libraries and their implementation of printf does not support the 'long double' type. As a work-around, you could cast to 'double' and pass that to printf instead. For example:
printf("value = %g\n", (double) my_long_double_value);
Note that a similar problem exists for 'long long' type. Use the 'I64' (eye sixty-four) length modifier instead of gcc's 'll' (ell ell). For example:
printf("value = %I64d\n", my_long_long_value);
Edit (6 years later): Also see the comment below from Keith Thompson for a workaround:
#define __USE_MINGW_ANSI_STDIO 1
in the source file or change the command line togcc -D__USE_MINGW_ANSI_STDIO=1
The MinGW C library is provided by MSVCRT.DLL, which is shipped with Windows and is in fact the old VC++ 6.0 library.
MinGW does however use the GNU C++ library, and although that relies on the underlying C library, it does support long double for output using iostreams. Even if you do not wish to use C++ generally, it may be worth using just enough to support this capability.