Hi!

There are lots of complaint about sqrt -- see bug #567. Martin Whitaker 
prepared a patch which I converted to git form for easy apply.

Please review.
diff --git a/mingw-w64-crt/math/sqrt.def.h b/mingw-w64-crt/math/sqrt.def.h
index 602409a..b6f5460 100644
--- a/mingw-w64-crt/math/sqrt.def.h
+++ b/mingw-w64-crt/math/sqrt.def.h
@@ -66,14 +66,20 @@ __FLT_ABI (sqrt) (__FLT_TYPE x)
 {
   __FLT_TYPE res = __FLT_CST (0.0);
   int x_class = fpclassify (x);
-  if (x_class == FP_NAN || signbit (x))
+  if (x_class == FP_NAN)
     {
-      if (x_class == FP_ZERO)
-       return __FLT_CST (-0.0);
-
       __FLT_RPT_DOMAIN ("sqrt", x, 0.0, x);
       return x;
     }
+  else if (signbit (x))
+    {
+      if (x_class == FP_ZERO)
+        return __FLT_CST (-0.0);
+
+      res = -__FLT_NAN;
+      __FLT_RPT_DOMAIN ("sqrt", x, 0.0, res);
+      return res;
+    }
   else if (x_class == FP_ZERO)
     return __FLT_CST (0.0);
   else if (x_class == FP_INFINITE)
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to