mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-14 19:03:14 +01:00
MinGW: Fixed long double formatting.
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user