Alex Henrie : msvcr120: Add atanh.
Alexandre Julliard
julliard at winehq.org
Thu Jul 13 14:41:33 CDT 2017
Module: wine
Branch: master
Commit: 860c1578e6ed130792ff6a9c5e5431ec005472ac
URL: http://source.winehq.org/git/wine.git/?a=commit;h=860c1578e6ed130792ff6a9c5e5431ec005472ac
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Wed Jul 12 18:05:19 2017 +0200
msvcr120: Add atanh.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
configure | 2 +
configure.ac | 2 +
.../api-ms-win-crt-math-l1-1-0.spec | 6 +-
dlls/msvcr120/msvcr120.spec | 6 +-
dlls/msvcr120_app/msvcr120_app.spec | 6 +-
dlls/msvcrt/math.c | 66 ++++++++++++++++++++++
dlls/ucrtbase/ucrtbase.spec | 6 +-
include/config.h.in | 6 ++
8 files changed, 88 insertions(+), 12 deletions(-)
diff --git a/configure b/configure
index 199d4d8..95cfa25 100755
--- a/configure
+++ b/configure
@@ -17410,6 +17410,8 @@ for ac_func in \
acoshf \
asinh \
asinhf \
+ atanh \
+ atanhf \
cbrt \
cbrtf \
erf \
diff --git a/configure.ac b/configure.ac
index 3974dd5..77b04b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2598,6 +2598,8 @@ AC_CHECK_FUNCS(\
acoshf \
asinh \
asinhf \
+ atanh \
+ atanhf \
cbrt \
cbrtf \
erf \
diff --git a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec
index 5c64432..fb5c350 100644
--- a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec
+++ b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec
@@ -136,9 +136,9 @@
@ cdecl atan2(double double) ucrtbase.atan2
@ cdecl -arch=arm,x86_64 atan2f(float float) ucrtbase.atan2f
@ cdecl -arch=arm,x86_64 atanf(float) ucrtbase.atanf
-@ stub atanh
-@ stub atanhf
-@ stub atanhl
+@ cdecl atanh(double) ucrtbase.atanh
+@ cdecl atanhf(float) ucrtbase.atanhf
+@ cdecl atanhl(double) ucrtbase.atanhl
@ stub cabs
@ stub cabsf
@ stub cabsl
diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec
index 7899622..323d5f4 100644
--- a/dlls/msvcr120/msvcr120.spec
+++ b/dlls/msvcr120/msvcr120.spec
@@ -2025,9 +2025,9 @@
@ cdecl -arch=arm,x86_64 atanf(float) MSVCRT_atanf
@ cdecl atan2(double double) MSVCRT_atan2
@ cdecl -arch=arm,x86_64 atan2f(float float) MSVCRT_atan2f
-@ stub atanh
-@ stub atanhf
-@ stub atanhl
+@ cdecl atanh(double) MSVCR120_atanh
+@ cdecl atanhf(float) MSVCR120_atanhf
+@ cdecl atanhl(double) MSVCR120_atanhl
@ cdecl -private atexit(ptr) MSVCRT_atexit # not imported to avoid conflicts with Mingw
@ cdecl atof(str) MSVCRT_atof
@ cdecl atoi(str) MSVCRT_atoi
diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec
index 9a5da20..73101c7 100644
--- a/dlls/msvcr120_app/msvcr120_app.spec
+++ b/dlls/msvcr120_app/msvcr120_app.spec
@@ -1691,9 +1691,9 @@
@ cdecl -arch=arm,x86_64 atanf(float) msvcr120.atanf
@ cdecl atan2(double double) msvcr120.atan2
@ cdecl -arch=arm,x86_64 atan2f(float float) msvcr120.atan2f
-@ stub atanh
-@ stub atanhf
-@ stub atanhl
+@ cdecl atanh(double) msvcr120.atanh
+@ cdecl atanhf(float) msvcr120.atanhf
+@ cdecl atanhl(double) msvcr120.atanhl
@ cdecl -private atexit(ptr) msvcr120.atexit
@ cdecl atof(str) msvcr120.atof
@ cdecl atoi(str) msvcr120.atoi
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 17edf47..9eed9b8 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -2944,6 +2944,72 @@ LDOUBLE CDECL MSVCR120_acoshl(LDOUBLE x)
}
/*********************************************************************
+ * atanh (MSVCR120.@)
+ */
+double CDECL MSVCR120_atanh(double x)
+{
+ double ret;
+
+ if (x > 1 || x < -1) {
+ MSVCRT_fenv_t env;
+
+ *MSVCRT__errno() = MSVCRT_EDOM;
+
+ /* on Linux atanh returns -NAN in this case */
+ MSVCRT_fegetenv(&env);
+ env.status |= MSVCRT__SW_INVALID;
+ MSVCRT_fesetenv(&env);
+ return NAN;
+ }
+
+#ifdef HAVE_ATANH
+ ret = atanh(x);
+#else
+ if (-1e-6 < x && x < 1e-6) ret = x + x*x*x/3;
+ else ret = (log(1+x) - log(1-x)) / 2;
+#endif
+
+ if (!isfinite(ret)) *MSVCRT__errno() = MSVCRT_ERANGE;
+ return ret;
+}
+
+/*********************************************************************
+ * atanhf (MSVCR120.@)
+ */
+float CDECL MSVCR120_atanhf(float x)
+{
+#ifdef HAVE_ATANHF
+ double ret;
+
+ if (x > 1 || x < -1) {
+ MSVCRT_fenv_t env;
+
+ *MSVCRT__errno() = MSVCRT_EDOM;
+
+ MSVCRT_fegetenv(&env);
+ env.status |= MSVCRT__SW_INVALID;
+ MSVCRT_fesetenv(&env);
+ return NAN;
+ }
+
+ ret = atanhf(x);
+
+ if (!isfinite(ret)) *MSVCRT__errno() = MSVCRT_ERANGE;
+ return ret;
+#else
+ return MSVCR120_atanh(x);
+#endif
+}
+
+/*********************************************************************
+ * atanhl (MSVCR120.@)
+ */
+LDOUBLE CDECL MSVCR120_atanhl(LDOUBLE x)
+{
+ return MSVCR120_atanh(x);
+}
+
+/*********************************************************************
* _scalb (MSVCRT.@)
* scalbn (MSVCR120.@)
* scalbln (MSVCR120.@)
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index 1eae072..aacf361 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -2167,9 +2167,9 @@
@ cdecl atan2(double double) MSVCRT_atan2
@ cdecl -arch=arm,x86_64 atan2f(float float) MSVCRT_atan2f
@ cdecl -arch=arm,x86_64 atanf(float) MSVCRT_atanf
-@ stub atanh
-@ stub atanhf
-@ stub atanhl
+@ cdecl atanh(double) MSVCR120_atanh
+@ cdecl atanhf(float) MSVCR120_atanhf
+@ cdecl atanhl(double) MSVCR120_atanhl
@ cdecl atof(str) MSVCRT_atof
@ cdecl atoi(str) MSVCRT_atoi
@ cdecl atol(str) ntdll.atol
diff --git a/include/config.h.in b/include/config.h.in
index 4a9acca..2e909fd 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -50,6 +50,12 @@
/* Define to 1 if you have the <asm/user.h> header file. */
#undef HAVE_ASM_USER_H
+/* Define to 1 if you have the `atanh' function. */
+#undef HAVE_ATANH
+
+/* Define to 1 if you have the `atanhf' function. */
+#undef HAVE_ATANHF
+
/* Define to 1 if you have the <AudioToolbox/AudioConverter.h> header file. */
#undef HAVE_AUDIOTOOLBOX_AUDIOCONVERTER_H
More information about the wine-cvs
mailing list