From f310332a6ba0427e38582673f4d3fbe4b3d9eb5c Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 25 Jun 2019 07:36:28 +0000 Subject: use __builtin_fpclassify for mingw x86 (tested up to gcc 8.1, it seems to have a bug in fpclassify, so [fpclassify 1e-314], x86 => normal, x64 => subnormal) --- generic/tclBasic.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v0.12