[PATCH 1/3] msvcrt: Don't set errno in sqrt(f) if x is positive infinity.

Alex Henrie alexhenrie24 at gmail.com
Tue Aug 1 01:13:35 CDT 2017


This behavior appears to be consistent across all versions of MSVC.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/msvcrt/math.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 2001d44a0b..c141feadff 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -279,7 +279,7 @@ float CDECL MSVCRT_sinhf( float x )
  */
 float CDECL MSVCRT_sqrtf( float x )
 {
-  if (x < 0.0 || !finitef(x)) *MSVCRT__errno() = MSVCRT_EDOM;
+  if (x < 0.0) *MSVCRT__errno() = MSVCRT_EDOM;
   return sqrtf(x);
 }
 
@@ -476,7 +476,7 @@ double CDECL MSVCRT_sinh( double x )
  */
 double CDECL MSVCRT_sqrt( double x )
 {
-  if (x < 0.0 || !isfinite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
+  if (x < 0.0) *MSVCRT__errno() = MSVCRT_EDOM;
   return sqrt(x);
 }
 
-- 
2.13.3




More information about the wine-patches mailing list