From: Jens Vollinga Date: Mon, 8 Sep 2008 16:17:51 +0000 (+0200) Subject: Fixed bug. G() ignored the imaginary parts of the arguments. X-Git-Tag: release_1-5-0~68 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=dacdde924c6d2e43ec52c2d6310d208d8e4024f6 Fixed bug. G() ignored the imaginary parts of the arguments. --- diff --git a/ginac/inifcns_nstdsums.cpp b/ginac/inifcns_nstdsums.cpp index dd8625a9..bf5ce093 100644 --- a/ginac/inifcns_nstdsums.cpp +++ b/ginac/inifcns_nstdsums.cpp @@ -1219,7 +1219,12 @@ static ex G2_evalf(const ex& x_, const ex& y) if (*it != _ex0) { all_zero = false; } - s.append(+1); + if ( !ex_to(*it).is_real() && ex_to(*it).imag() < 0 ) { + s.append(-1); + } + else { + s.append(+1); + } } if (all_zero) { return pow(log(y), x.nops()) / factorial(x.nops()); @@ -1255,7 +1260,12 @@ static ex G2_eval(const ex& x_, const ex& y) if (*it != _ex0) { all_zero = false; } - s.append(+1); + if ( !ex_to(*it).is_real() && ex_to(*it).imag() < 0 ) { + s.append(-1); + } + else { + s.append(+1); + } } if (all_zero) { return pow(log(y), x.nops()) / factorial(x.nops()); @@ -1308,10 +1318,21 @@ static ex G3_evalf(const ex& x_, const ex& s_, const ex& y) if (*itx != _ex0) { all_zero = false; } - if (*its >= 0) { - sn.append(+1); - } else { - sn.append(-1); + if ( ex_to(*itx).is_real() ) { + if ( *its >= 0 ) { + sn.append(+1); + } + else { + sn.append(-1); + } + } + else { + if ( ex_to(*itx).imag() > 0 ) { + sn.append(+1); + } + else { + sn.append(-1); + } } } if (all_zero) { @@ -1355,10 +1376,21 @@ static ex G3_eval(const ex& x_, const ex& s_, const ex& y) if (*itx != _ex0) { all_zero = false; } - if (*its >= 0) { - sn.append(+1); - } else { - sn.append(-1); + if ( ex_to(*itx).is_real() ) { + if ( *its >= 0 ) { + sn.append(+1); + } + else { + sn.append(-1); + } + } + else { + if ( ex_to(*itx).imag() > 0 ) { + sn.append(+1); + } + else { + sn.append(-1); + } } } if (all_zero) {