summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclBasic.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index a23bfc1..ea96108 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -8340,7 +8340,13 @@ ClassifyDouble(
double d)
{
#ifdef fpclassify
+/* MINGW x86 (tested up to gcc 8.1) seems to have a bug in fpclassify,
+ * [fpclassify 1e-314], x86 => normal, x64 => subnormal */
+# if defined(__MINGW32__) && defined(_X86_)
+ return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, d);
+# else
return fpclassify(d);
+# endif
#else /* !fpclassify */
#define FP_ZERO 0
#define FP_NORMAL 1