Skip to content

Commit

Permalink
MinGW: Fixed long double formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadlinger committed Jun 6, 2013
1 parent de11ae6 commit 0ebdc7f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/root/longdouble.h
Expand Up @@ -22,6 +22,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)
{
if (((longdouble)(unsigned long long)x) == x)
Expand All @@ -40,6 +46,10 @@ inline size_t ld_sprint(char* str, int fmt, longdouble x)
}
}

#if __MINGW32__
#undef sprintf
#endif

#else

#include <float.h>
Expand Down

0 comments on commit 0ebdc7f

Please sign in to comment.