about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/mathfunc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Src/Modules/mathfunc.c b/Src/Modules/mathfunc.c
index 04483b555..efadd86ff 100644
--- a/Src/Modules/mathfunc.c
+++ b/Src/Modules/mathfunc.c
@@ -340,7 +340,16 @@ math_func(char *name, int argc, mnumber *argv, int id)
       break;
 
   case MF_GAMMA:
+#ifdef HAVE_TGAMMA
+      retd = tgamma(argd);
+#else
+#ifdef HAVE_SIGNGAM
+      retd = lgamma(argd);
+      retd = signgam*exp(retd);
+#else /*XXX assume gamma(x) returns Gamma(x), not log(|Gamma(x)|) */
       retd = gamma(argd);
+#endif
+#endif
       break;
 
   case MF_HYPOT: