Added patch to calculate msvcrt exponential math operations with higher precision.

This commit is contained in:
Sebastian Lackner
2015-04-10 08:05:36 +02:00
parent 77bc095cb4
commit c382d2430b
5 changed files with 172 additions and 29 deletions

View File

@@ -0,0 +1,117 @@
From af8345987e58c2a5e6df44590e677a65ca71594c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 10 Apr 2015 07:51:16 +0200
Subject: msvcrt: Calculate sinh/cosh/exp/pow with higher precision.
Based on a patch by Zheng Chen.
---
configure.ac | 32 ++++++++++++++++++++++++++++++++
dlls/msvcrt/math.c | 21 +++++++++++++++++----
2 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 688ab26..30e8ef2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2586,6 +2586,38 @@ then
AC_DEFINE(HAVE_ISNAN, 1, [Define to 1 if you have the `isnan' function.])
fi
+dnl Check for coshl
+AC_CACHE_CHECK([for coshl], ac_cv_have_coshl,
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[float f = 0.0; return coshl(f)]])],[ac_cv_have_coshl="yes"],[ac_cv_have_coshl="no"]))
+if test "$ac_cv_have_coshl" = "yes"
+then
+ AC_DEFINE(HAVE_COSHL, 1, [Define to 1 if you have the `coshl' function.])
+fi
+
+dnl Check for sinhl
+AC_CACHE_CHECK([for sinhl], ac_cv_have_sinhl,
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[float f = 0.0; return sinhl(f)]])],[ac_cv_have_sinhl="yes"],[ac_cv_have_sinhl="no"]))
+if test "$ac_cv_have_sinhl" = "yes"
+then
+ AC_DEFINE(HAVE_SINHL, 1, [Define to 1 if you have the `sinhl' function.])
+fi
+
+dnl Check for expl
+AC_CACHE_CHECK([for expl], ac_cv_have_expl,
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[float f = 0.0; return expl(f)]])],[ac_cv_have_expl="yes"],[ac_cv_have_expl="no"]))
+if test "$ac_cv_have_expl" = "yes"
+then
+ AC_DEFINE(HAVE_EXPL, 1, [Define to 1 if you have the `expl' function.])
+fi
+
+dnl Check for powl
+AC_CACHE_CHECK([for powl], ac_cv_have_powl,
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[float f = 0.0; return powl(f, f)]])],[ac_cv_have_powl="yes"],[ac_cv_have_powl="no"]))
+if test "$ac_cv_have_powl" = "yes"
+then
+ AC_DEFINE(HAVE_POWL, 1, [Define to 1 if you have the `powl' function.])
+fi
+
AC_CHECK_FUNCS(\
cbrt \
cbrtf \
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 7c971d3..d48199e 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -51,6 +51,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#define signbit(x) ((x) < 0)
#endif
+#ifndef HAVE_COSHL
+#define coshl(x) cosh(x)
+#endif
+#ifndef HAVE_SINHL
+#define sinhl(x) sinh(x)
+#endif
+#ifndef HAVE_EXPL
+#define expl(x) exp(x)
+#endif
+#ifndef HAVE_POWL
+#define powl(x,y) pow(x,y)
+#endif
+
typedef int (CDECL *MSVCRT_matherr_func)(struct MSVCRT__exception *);
typedef double LDOUBLE; /* long double is just a double */
@@ -394,7 +407,7 @@ double CDECL MSVCRT_cos( double x )
double CDECL MSVCRT_cosh( double x )
{
if (!isfinite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
- return cosh(x);
+ return coshl(x);
}
/*********************************************************************
@@ -403,7 +416,7 @@ double CDECL MSVCRT_cosh( double x )
double CDECL MSVCRT_exp( double x )
{
if (isnan(x)) *MSVCRT__errno() = MSVCRT_EDOM;
- return exp(x);
+ return expl(x);
}
/*********************************************************************
@@ -441,7 +454,7 @@ double CDECL MSVCRT_log10( double x )
double CDECL MSVCRT_pow( double x, double y )
{
/* FIXME: If x < 0 and y is not integral, set EDOM */
- double z = pow(x,y);
+ double z = powl(x,y);
if (!isfinite(z)) *MSVCRT__errno() = MSVCRT_EDOM;
return z;
}
@@ -461,7 +474,7 @@ double CDECL MSVCRT_sin( double x )
double CDECL MSVCRT_sinh( double x )
{
if (!isfinite(x)) *MSVCRT__errno() = MSVCRT_EDOM;
- return sinh(x);
+ return sinhl(x);
}
/*********************************************************************
--
2.3.5

View File

@@ -0,0 +1 @@
Fixes: [37149] Calculate msvcrt exponential math operations with higher precision