X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Finifcns_nstdsums.cpp;h=c33a4cf8370d22020e302b0c08e1ade04f6a24f1;hp=5f5949b69175067e54b2e3e699d6ba38b13c718d;hb=22dbae3e0d20ffd06e405100c295aeabfc0dfa5a;hpb=5bf87cea66bb2071222c2910ed68c2649a98906c diff --git a/ginac/inifcns_nstdsums.cpp b/ginac/inifcns_nstdsums.cpp index 5f5949b6..c33a4cf8 100644 --- a/ginac/inifcns_nstdsums.cpp +++ b/ginac/inifcns_nstdsums.cpp @@ -346,7 +346,11 @@ cln::cl_N Li_projection(int n, const cln::cl_N& x, const cln::float_format_t& pr } else { // choose the faster algorithm if (cln::abs(cln::realpart(x)) > 0.75) { - return -Li2_do_sum(1-x) - cln::log(x) * cln::log(1-x) + cln::zeta(2); + if ( x == 1 ) { + return cln::zeta(2); + } else { + return -Li2_do_sum(1-x) - cln::log(x) * cln::log(1-x) + cln::zeta(2); + } } else { return -Li2_do_sum_Xn(1-x) - cln::log(x) * cln::log(1-x) + cln::zeta(2); } @@ -368,7 +372,8 @@ cln::cl_N Li_projection(int n, const cln::cl_N& x, const cln::float_format_t& pr return Lin_do_sum_Xn(n, x); } } else { - cln::cl_N result = -cln::expt(cln::log(x), n-1) * cln::log(1-x) / cln::factorial(n-1); + cln::cl_N result = 0; + if ( x != 1 ) result = -cln::expt(cln::log(x), n-1) * cln::log(1-x) / cln::factorial(n-1); for (int j=0; j(*itx).to_cl_N(); - newx.push_back(factor/xi); factor = factor/xi; - s.push_back(1); + newx.push_back(factor); + if ( !instanceof(factor, cln::cl_R_ring) && imagpart(factor) < 0 ) { + s.push_back(-1); + } + else { + s.push_back(1); + } } return numeric(cln::cl_N(1 & m.nops() ? - 1 : 1)*G_numeric(newx, s, cln::cl_N(1))); } @@ -1350,12 +1360,16 @@ static ex G3_evalf(const ex& x_, const ex& s_, const ex& y) all_zero = false; } if ( ex_to(*itx).is_real() ) { - if ( *its >= 0 ) { + if ( ex_to(*itx).is_positive() ) { + if ( *its >= 0 ) { + sn.push_back(1); + } + else { + sn.push_back(-1); + } + } else { sn.push_back(1); } - else { - sn.push_back(-1); - } } else { if ( ex_to(*itx).imag() > 0 ) { @@ -1414,12 +1428,16 @@ static ex G3_eval(const ex& x_, const ex& s_, const ex& y) all_zero = false; } if ( ex_to(*itx).is_real() ) { - if ( *its >= 0 ) { + if ( ex_to(*itx).is_positive() ) { + if ( *its >= 0 ) { + sn.push_back(1); + } + else { + sn.push_back(-1); + } + } else { sn.push_back(1); } - else { - sn.push_back(-1); - } } else { if ( ex_to(*itx).imag() > 0 ) {