[PATCH 2/5] msvcr120: Set errno in log2.

Alex Henrie alexhenrie24 at gmail.com
Mon Jul 17 23:33:52 CDT 2017


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

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index b12ce8b4f9..637f9208c3 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -2488,6 +2488,8 @@ LDOUBLE CDECL MSVCR120_log1pl(LDOUBLE x)
  */
 double CDECL MSVCR120_log2(double x)
 {
+    if (x < 0) *MSVCRT__errno() = MSVCRT_EDOM;
+    else if (x == 0) *MSVCRT__errno() = MSVCRT_ERANGE;
 #ifdef HAVE_LOG2
     return log2(x);
 #else
@@ -2500,6 +2502,8 @@ double CDECL MSVCR120_log2(double x)
  */
 float CDECL MSVCR120_log2f(float x)
 {
+    if (x < 0) *MSVCRT__errno() = MSVCRT_EDOM;
+    else if (x == 0) *MSVCRT__errno() = MSVCRT_ERANGE;
 #ifdef HAVE_LOG2F
     return log2f(x);
 #else
-- 
2.13.3




More information about the wine-patches mailing list