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

@ -39,6 +39,11 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [1]:**
* Calculate msvcrt exponential math operations with higher precision ([Wine Bug #37149](https://bugs.winehq.org/show_bug.cgi?id=37149))
**Bug fixes and features in Wine Staging 1.7.40 [220]:**
*Note: The following list only contains features and bug fixes which are not

1
debian/changelog vendored
View File

@ -3,6 +3,7 @@ wine-staging (1.7.41) UNRELEASED; urgency=low
* Added patch to enable/disable EAX support via winecfg.
* Added patch with stub for setupapi.SetupDiSetDeviceInstallParamsW.
* Added first part of patchset containing various improvements for LsaLookupSids.
* Added patch to calculate msvcrt exponential math operations with higher precision.
* Added tests for RtlIpv6AddressToString and RtlIpv6AddressToStringEx.
* Removed patches to fix invalid memory access in get_registry_locale_info (accepted upstream).
* Removed patches to avoid repeated FIXMEs in PsLookupProcessByProcessId stub (accepted upstream).

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

View File

@ -129,6 +129,7 @@ patch_enable_all ()
enable_mountmgr_DosDevices="$1"
enable_mscoree_CorValidateImage="$1"
enable_msvcp90_basic_string_wchar_dtor="$1"
enable_msvcrt_Math_Precision="$1"
enable_msvcrt_atof_strtod="$1"
enable_msvfw32_Image_Size="$1"
enable_ntdll_APC_Performance="$1"
@ -453,6 +454,9 @@ patch_enable ()
msvcp90-basic_string_wchar_dtor)
enable_msvcp90_basic_string_wchar_dtor="$2"
;;
msvcrt-Math_Precision)
enable_msvcrt_Math_Precision="$2"
;;
msvcrt-atof_strtod)
enable_msvcrt_atof_strtod="$2"
;;
@ -1985,6 +1989,21 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Multisampling
# |
# | This patchset fixes the following Wine bugs:
# | * [#12652] Allow to override number of quality levels for D3DMULTISAMPLE_NONMASKABLE.
# |
# | Modified files:
# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Multisampling" -eq 1; then
patch_apply wined3d-Multisampling/0001-wined3d-Allow-to-specify-multisampling-AA-quality-le.patch
(
echo '+ { "Austin English", "wined3d: Allow to specify multisampling AA quality levels via registry.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-Revert_PixelFormat
# |
# | This patchset fixes the following Wine bugs:
@ -2055,21 +2074,6 @@ if test "$enable_wined3d_wined3d_swapchain_present" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Multisampling
# |
# | This patchset fixes the following Wine bugs:
# | * [#12652] Allow to override number of quality levels for D3DMULTISAMPLE_NONMASKABLE.
# |
# | Modified files:
# | * dlls/wined3d/directx.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Multisampling" -eq 1; then
patch_apply wined3d-Multisampling/0001-wined3d-Allow-to-specify-multisampling-AA-quality-le.patch
(
echo '+ { "Austin English", "wined3d: Allow to specify multisampling AA quality levels via registry.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset fixes the following Wine bugs:
@ -2652,20 +2656,6 @@ if test "$enable_kernel32_Console_Handles" -eq 1; then
) >> "$patchlist"
fi
# Patchset kernel32-SetFileInformationByHandle
# |
# | Modified files:
# | * dlls/kernel32/file.c, include/winbase.h
# |
if test "$enable_kernel32_SetFileInformationByHandle" -eq 1; then
patch_apply kernel32-SetFileInformationByHandle/0001-include-Declare-a-couple-more-file-information-class.patch
patch_apply kernel32-SetFileInformationByHandle/0002-kernel32-Implement-SetFileInformationByHandle.patch
(
echo '+ { "Michael Müller", "include: Declare a couple more file information class structures.", 1 },';
echo '+ { "Michael Müller", "kernel32: Implement SetFileInformationByHandle.", 1 },';
) >> "$patchlist"
fi
# Patchset server-File_Permissions
# |
# | Modified files:
@ -2703,6 +2693,20 @@ if test "$enable_ntdll_FileDispositionInformation" -eq 1; then
) >> "$patchlist"
fi
# Patchset kernel32-SetFileInformationByHandle
# |
# | Modified files:
# | * dlls/kernel32/file.c, include/winbase.h
# |
if test "$enable_kernel32_SetFileInformationByHandle" -eq 1; then
patch_apply kernel32-SetFileInformationByHandle/0001-include-Declare-a-couple-more-file-information-class.patch
patch_apply kernel32-SetFileInformationByHandle/0002-kernel32-Implement-SetFileInformationByHandle.patch
(
echo '+ { "Michael Müller", "include: Declare a couple more file information class structures.", 1 },';
echo '+ { "Michael Müller", "kernel32: Implement SetFileInformationByHandle.", 1 },';
) >> "$patchlist"
fi
# Patchset kernel32-CopyFileEx
# |
# | This patchset fixes the following Wine bugs:
@ -3003,6 +3007,21 @@ if test "$enable_msvcp90_basic_string_wchar_dtor" -eq 1; then
) >> "$patchlist"
fi
# Patchset msvcrt-Math_Precision
# |
# | This patchset fixes the following Wine bugs:
# | * [#37149] Calculate msvcrt exponential math operations with higher precision
# |
# | Modified files:
# | * configure.ac, dlls/msvcrt/math.c
# |
if test "$enable_msvcrt_Math_Precision" -eq 1; then
patch_apply msvcrt-Math_Precision/0001-msvcrt-Calculate-sinh-cosh-exp-pow-with-higher-preci.patch
(
echo '+ { "Sebastian Lackner", "msvcrt: Calculate sinh/cosh/exp/pow with higher precision.", 1 },';
) >> "$patchlist"
fi
# Patchset msvcrt-atof_strtod
# |
# | This patchset fixes the following Wine bugs: