From: Stefan Weinzierl Date: Sun, 12 Jan 2014 22:19:56 +0000 (+0000) Subject: Fix G3_evalf and G3_eval for real and negative x. X-Git-Tag: release_1-6-3~27 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=22dbae3e0d20ffd06e405100c295aeabfc0dfa5a;ds=sidebyside Fix G3_evalf and G3_eval for real and negative x. The user supplied signs of the imaginary parts are only relevant for x real and positive. A negative sign in the case of x real and negative is irrelevant (there is no branch cut) and led to wrong results. This is now avoided. --- diff --git a/ginac/inifcns_nstdsums.cpp b/ginac/inifcns_nstdsums.cpp index 043d93a8..c33a4cf8 100644 --- a/ginac/inifcns_nstdsums.cpp +++ b/ginac/inifcns_nstdsums.cpp @@ -1360,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 ) { @@ -1424,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 ) {