[GiNaC-devel] [PATCH 8/8] define lgamma and tgamma taking cl_N as an argument.

Alexei Sheplyakov varg at theor.jinr.ru
Wed Mar 19 10:28:34 CET 2008


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 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp
index 4cbaa7d..d2c10f6 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);
 }
 
-- 
1.5.4.2


-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20080319/a1b2f591/attachment.sig>


More information about the GiNaC-devel mailing list