From ef4d20ad6fde1ca519a19ad60f2c31d86f5b1d98 Mon Sep 17 00:00:00 2001 From: Jun T Date: Sun, 27 Oct 2013 00:41:03 +0900 Subject: 31902: rationalise use of gamma function. Make zsh/mathfunc consistent across systems and use tgamma() where available --- Src/Modules/mathfunc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Src/Modules') 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: -- cgit 1.4.1