From: Richard Kreckel Date: Thu, 13 May 2010 16:30:40 +0000 (+0200) Subject: Explicit function disambiguation. X-Git-Tag: release_1-5-8~12 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=511764215de1756329e88c2628a4fd36e8277195 Explicit function disambiguation. This is necessary for compilers where the hyperbolic and the tgamma function templates are pulled in from and compete with GiNaC's function templates. GCC 4.4 and 4.5 need this, when compiling with -std=cxx0x. --- diff --git a/check/exam_inifcns.cpp b/check/exam_inifcns.cpp index 37dd05d2..454a8263 100644 --- a/check/exam_inifcns.cpp +++ b/check/exam_inifcns.cpp @@ -31,6 +31,7 @@ using namespace std; static unsigned inifcns_consist_trans() { using GiNaC::asin; using GiNaC::acos; + using GiNaC::asinh; using GiNaC::acosh; using GiNaC::atanh; unsigned result = 0; symbol x("x"); @@ -124,6 +125,7 @@ static unsigned inifcns_consist_trans() * exists in closed form and check if it's ok. */ static unsigned inifcns_consist_gamma() { + using GiNaC::tgamma; unsigned result = 0; ex e; @@ -170,6 +172,7 @@ static unsigned inifcns_consist_gamma() static unsigned inifcns_consist_psi() { using GiNaC::log; + using GiNaC::tgamma; unsigned result = 0; symbol x; diff --git a/check/exam_inifcns_nstdsums.cpp b/check/exam_inifcns_nstdsums.cpp index 4d81233b..b836ee4f 100644 --- a/check/exam_inifcns_nstdsums.cpp +++ b/check/exam_inifcns_nstdsums.cpp @@ -80,7 +80,7 @@ static unsigned inifcns_test_S() int digitsbuf = Digits; // precision of data Digits = 22; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); unsigned result = 0; @@ -125,9 +125,10 @@ static unsigned inifcns_test_S() static unsigned inifcns_test_HLi() { + using GiNaC::log; int digitsbuf = Digits; Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); numeric almostone("0.999999999999999999"); unsigned result = 0; @@ -198,7 +199,7 @@ static unsigned inifcns_test_zeta() for (lst::const_iterator it = res.begin(); it != res.end(); it++) { Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); ex diff = abs((*it).evalf()); if (diff > prec) { clog << *it << " seems to be wrong: " << diff << endl; @@ -207,7 +208,7 @@ static unsigned inifcns_test_zeta() } cout << "." << flush; Digits = 40; - prec = 5 * pow(10, -(int)Digits); + prec = 5 * pow(10, -(ex)Digits); diff = abs((*it).evalf()); if (diff > prec) { clog << *it << " seems to be wrong: " << diff << endl; @@ -234,7 +235,7 @@ static unsigned inifcns_test_LiG() { int digitsbuf = Digits; Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); numeric almostone("0.99999999999999999999"); unsigned result = 0; @@ -300,7 +301,7 @@ static unsigned inifcns_test_LiG() static unsigned inifcns_test_legacy() { Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); unsigned result = 0; @@ -327,7 +328,7 @@ static unsigned inifcns_test_legacy() } Digits = 100; - prec = 5 * pow(10, -(int)Digits); + prec = 5 * pow(10, -(ex)Digits); ex x0 = 1.; x1 = exp(Pi*I/3).evalf(); x2 = exp(2*Pi*I/3).evalf(); diff --git a/check/exam_pseries.cpp b/check/exam_pseries.cpp index 4b614333..42650cc0 100644 --- a/check/exam_pseries.cpp +++ b/check/exam_pseries.cpp @@ -173,6 +173,7 @@ static unsigned exam_series3() // Series exponentiation static unsigned exam_series4() { + using GiNaC::tgamma; unsigned result = 0; ex e, d; @@ -211,6 +212,7 @@ static unsigned exam_series5() // Series expansion of tgamma(-1) static unsigned exam_series6() { + using GiNaC::tgamma; ex e = tgamma(2*x); ex d = pow(x+1,-1)*numeric(1,4) + pow(x+1,0)*(numeric(3,4) - @@ -328,6 +330,7 @@ static unsigned exam_series11() static unsigned exam_series12() { using GiNaC::log; + using GiNaC::atanh; unsigned result = 0; ex e, d; diff --git a/check/time_antipode.cpp b/check/time_antipode.cpp index 448270cb..4f678382 100644 --- a/check/time_antipode.cpp +++ b/check/time_antipode.cpp @@ -72,6 +72,7 @@ static ex div_part(const ex &exarg, const symbol &x, unsigned grad) /* F_ab(a, i, b, j, "x") is a common pattern in all vertex evaluators. */ static ex F_ab(int a, int i, int b, int j, const symbol &x) { + using GiNaC::tgamma; if ((i==0 && a<=0) || (j==0 && b<=0)) return 0; else diff --git a/check/time_gammaseries.cpp b/check/time_gammaseries.cpp index 3f07f646..cd09eacc 100644 --- a/check/time_gammaseries.cpp +++ b/check/time_gammaseries.cpp @@ -33,13 +33,13 @@ unsigned tgammaseries(unsigned order) unsigned result = 0; symbol x; - ex myseries = series(tgamma(x),x==0,order); + ex myseries = series(GiNaC::tgamma(x),x==0,order); // compute the last coefficient numerically: ex last_coeff = myseries.coeff(x,order-1).evalf(); // compute a bound for that coefficient using a variation of the leading // term in Stirling's formula: ex bound = exp(-.57721566490153286*(order-1))/(order-1); - if (abs((last_coeff-pow(-1,order))/bound) > 1) { + if (abs((last_coeff-pow(-1,ex(order)))/bound) > 1) { clog << "The " << order-1 << "th order coefficient in the power series expansion of tgamma(0) was erroneously found to be " << last_coeff << ", violating a simple estimate." << endl; diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index 359e22b3..9783bf8c 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -727,7 +727,7 @@ static void insert_fcns(const fcn_init *p) static ex f_ginac_function(const exprseq &es, int serial) { - return function(serial, es).eval(1); + return GiNaC::function(serial, es).eval(1); } // All registered GiNaC functions