From a7693a0f710b49494f95ce5a4a0953752e69c7f9 Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Wed, 19 Mar 2008 12:28:34 +0300 Subject: [PATCH] define lgamma and tgamma taking cl_N as an argument. The actual code is the same. These functions are OK since cl_N is not automatically converted to numeric any more. --- ginac/numeric.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 1b980403..69a787b5 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -1977,7 +1977,7 @@ static const cln::float_format_t guess_precision(const cln::cl_N& x) * sufficiently many or sufficiently accurate, more can be calculated * using the program doc/examples/lanczos.cpp. In that case, be sure to * read the comments in that file. */ -const cln::cl_N lgamma_(const cln::cl_N &x) +const cln::cl_N lgamma(const cln::cl_N &x) { cln::float_format_t prec = guess_precision(x); lanczos_coeffs lc; @@ -1985,7 +1985,7 @@ const cln::cl_N lgamma_(const cln::cl_N &x) cln::cl_N pi_val = cln::pi(prec); if (realpart(x) < 0.5) return cln::log(pi_val) - cln::log(sin(pi_val*x)) - - lgamma_(1 - x); + - lgamma(1 - x); cln::cl_N A = lc.calc_lanczos_A(x); cln::cl_N temp = x + lc.get_order() - cln::cl_N(1)/2; cln::cl_N result = log(cln::cl_I(2)*pi_val)/2 @@ -2001,18 +2001,18 @@ const cln::cl_N lgamma_(const cln::cl_N &x) const numeric lgamma(const numeric &x) { const cln::cl_N x_ = x.to_cl_N(); - const cln::cl_N result = lgamma_(x_); + const cln::cl_N result = lgamma(x_); return numeric(result); } -const cln::cl_N tgamma_(const cln::cl_N &x) +const cln::cl_N tgamma(const cln::cl_N &x) { cln::float_format_t prec = guess_precision(x); lanczos_coeffs lc; if (lc.sufficiently_accurate(prec)) { cln::cl_N pi_val = cln::pi(prec); if (realpart(x) < 0.5) - return pi_val/(cln::sin(pi_val*x))/tgamma_(1 - x); + return pi_val/(cln::sin(pi_val*x))/tgamma(1 - x); cln::cl_N A = lc.calc_lanczos_A(x); cln::cl_N temp = x + lc.get_order() - cln::cl_N(1)/2; cln::cl_N result @@ -2027,7 +2027,7 @@ const cln::cl_N tgamma_(const cln::cl_N &x) const numeric tgamma(const numeric &x) { const cln::cl_N x_ = x.to_cl_N(); - const cln::cl_N result = tgamma_(x_); + const cln::cl_N result = tgamma(x_); return numeric(result); } -- 2.44.0