Martin Storsjo : msvcrt: Implement the tgamma functions.
Alexandre Julliard
julliard at winehq.org
Fri Aug 2 14:26:30 CDT 2019
Module: wine
Branch: master
Commit: e38b46e7f7250e4e7c8d7979a845cdc1106677be
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e38b46e7f7250e4e7c8d7979a845cdc1106677be
Author: Martin Storsjo <martin at martin.st>
Date: Thu Aug 1 22:52:26 2019 +0300
msvcrt: Implement the tgamma functions.
Signed-off-by: Martin Storsjo <martin at martin.st>
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 | 38 ++++++++++++++++++++++
dlls/ucrtbase/ucrtbase.spec | 6 ++--
include/config.h.in | 6 ++++
8 files changed, 60 insertions(+), 12 deletions(-)
diff --git a/configure b/configure
index ed56167..44e283e 100755
--- a/configure
+++ b/configure
@@ -19289,6 +19289,8 @@ for ac_func in \
rintf \
round \
roundf \
+ tgamma \
+ tgammaf \
trunc \
truncf \
y0 \
diff --git a/configure.ac b/configure.ac
index 0fe2602..c58d343 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2676,6 +2676,8 @@ AC_CHECK_FUNCS(\
rintf \
round \
roundf \
+ tgamma \
+ tgammaf \
trunc \
truncf \
y0 \
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 73967ea..eb7017f 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
@@ -333,9 +333,9 @@
@ cdecl -arch=arm,x86_64,arm64 tanf(float) ucrtbase.tanf
@ cdecl tanh(double) ucrtbase.tanh
@ cdecl -arch=arm,x86_64,arm64 tanhf(float) ucrtbase.tanhf
-@ stub tgamma
-@ stub tgammaf
-@ stub tgammal
+@ cdecl tgamma(double) ucrtbase.tgamma
+@ cdecl tgammaf(float) ucrtbase.tgammaf
+@ cdecl tgammal(double) ucrtbase.tgammal
@ cdecl trunc(double) ucrtbase.trunc
@ cdecl truncf(float) ucrtbase.truncf
@ cdecl truncl(double) ucrtbase.truncl
diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec
index d7c5843..469bc01 100644
--- a/dlls/msvcr120/msvcr120.spec
+++ b/dlls/msvcr120/msvcr120.spec
@@ -2405,9 +2405,9 @@
@ cdecl -arch=arm,x86_64,arm64 tanf(float) MSVCRT_tanf
@ cdecl tanh(double) MSVCRT_tanh
@ cdecl -arch=arm,x86_64,arm64 tanhf(float) MSVCRT_tanhf
-@ stub tgamma
-@ stub tgammaf
-@ stub tgammal
+@ cdecl tgamma(double) MSVCR120_tgamma
+@ cdecl tgammaf(float) MSVCR120_tgammaf
+@ cdecl tgammal(double) MSVCR120_tgamma
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec
index 2dcf191..f9e3a00 100644
--- a/dlls/msvcr120_app/msvcr120_app.spec
+++ b/dlls/msvcr120_app/msvcr120_app.spec
@@ -2067,9 +2067,9 @@
@ cdecl -arch=arm,x86_64,arm64 tanf(float) msvcr120.tanf
@ cdecl tanh(double) msvcr120.tanh
@ cdecl -arch=arm,x86_64,arm64 tanhf(float) msvcr120.tanhf
-@ stub tgamma
-@ stub tgammaf
-@ stub tgammal
+@ cdecl tgamma(double) msvcr120.tgamma
+@ cdecl tgammaf(float) msvcr120.tgammaf
+@ cdecl tgammal(double) msvcr120.tgammal
@ cdecl tmpfile() msvcr120.tmpfile
@ cdecl tmpfile_s(ptr) msvcr120.tmpfile_s
@ cdecl tmpnam(ptr) msvcr120.tmpnam
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 841a231..6651df8 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -3405,6 +3405,44 @@ LDOUBLE CDECL MSVCR120_lgammal(LDOUBLE x)
}
/*********************************************************************
+ * tgamma (MSVCR120.@)
+ */
+double CDECL MSVCR120_tgamma(double x)
+{
+#ifdef HAVE_TGAMMA
+ if(x==0.0) *MSVCRT__errno() = MSVCRT_ERANGE;
+ if(x<0.0f) {
+ double integral;
+ if (modf(x, &integral) == 0)
+ *MSVCRT__errno() = MSVCRT_EDOM;
+ }
+ return tgamma(x);
+#else
+ FIXME( "not implemented\n" );
+ return 0.0;
+#endif
+}
+
+/*********************************************************************
+ * tgammaf (MSVCR120.@)
+ */
+float CDECL MSVCR120_tgammaf(float x)
+{
+#ifdef HAVE_TGAMMAF
+ if(x==0.0f) *MSVCRT__errno() = MSVCRT_ERANGE;
+ if(x<0.0f) {
+ float integral;
+ if (modff(x, &integral) == 0)
+ *MSVCRT__errno() = MSVCRT_EDOM;
+ }
+ return tgammaf(x);
+#else
+ FIXME( "not implemented\n" );
+ return 0.0f;
+#endif
+}
+
+/*********************************************************************
* nan (MSVCR120.@)
*/
double CDECL MSVCR120_nan(const char *tagp)
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index cde137d..2a5fdf2 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -2534,9 +2534,9 @@
@ cdecl tanh(double) MSVCRT_tanh
@ cdecl -arch=arm,x86_64,arm64 tanhf(float) MSVCRT_tanhf
@ cdecl terminate() MSVCRT_terminate
-@ stub tgamma
-@ stub tgammaf
-@ stub tgammal
+@ cdecl tgamma(double) MSVCR120_tgamma
+@ cdecl tgammaf(float) MSVCR120_tgammaf
+@ cdecl tgammal(double) MSVCR120_tgamma
@ cdecl tmpfile() MSVCRT_tmpfile
@ cdecl tmpfile_s(ptr) MSVCRT_tmpfile_s
@ cdecl tmpnam(ptr) MSVCRT_tmpnam
diff --git a/include/config.h.in b/include/config.h.in
index ce5c157..29ea6f0 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1166,6 +1166,12 @@
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
+/* Define to 1 if you have the `tgamma' function. */
+#undef HAVE_TGAMMA
+
+/* Define to 1 if you have the `tgammaf' function. */
+#undef HAVE_TGAMMAF
+
/* Define to 1 if you have the `thr_kill2' function. */
#undef HAVE_THR_KILL2
More information about the wine-cvs
mailing list