And version 2 proposed by Kai Tietz.

W dniu 2017-02-17 o 10:10, Mateusz pisze:
> 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..0cd401d 100644
--- a/mingw-w64-crt/math/sqrt.def.h
+++ b/mingw-w64-crt/math/sqrt.def.h
@@ -71,8 +71,15 @@ __FLT_ABI (sqrt) (__FLT_TYPE x)
       if (x_class == FP_ZERO)
        return __FLT_CST (-0.0);
 
-      __FLT_RPT_DOMAIN ("sqrt", x, 0.0, x);
-      return x;
+      if (x_class == FP_NAN)
+        {
+          __FLT_RPT_DOMAIN ("sqrt", x, 0.0, x);
+          return x;
+        }
+
+      res = -__FLT_NAN;
+      __FLT_RPT_DOMAIN ("sqrt", x, 0.0, res);
+      return res;
     }
   else if (x_class == FP_ZERO)
     return __FLT_CST (0.0);
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to