MinGW: Fixed long double formatting.

This commit is contained in:
David Nadlinger
2013-05-29 22:17:50 +02:00
parent 0b5989c51a
commit 798a8e7822

View File

@@ -34,6 +34,12 @@ typedef volatile long double volatile_longdouble;
// template<typename T> longdouble ldouble(T x) { return (longdouble) x; }
#define ldouble(x) ((longdouble)(x))
#if __MINGW32__
// MinGW supports 80 bit reals, but the formatting functions map to versions
// from the MSVC runtime by default which don't.
#define sprintf __mingw_sprintf
#endif
inline size_t ld_sprint(char* str, int fmt, longdouble x)
{
char sfmt[4] = "%Lg";
@@ -41,6 +47,10 @@ inline size_t ld_sprint(char* str, int fmt, longdouble x)
return sprintf(str, sfmt, x);
}
#if __MINGW32__
#undef sprintf
#endif
#else
#include <float.h>