From 22dbae3e0d20ffd06e405100c295aeabfc0dfa5a Mon Sep 17 00:00:00 2001 From: Stefan Weinzierl Date: Sun, 12 Jan 2014 22:19:56 +0000 Subject: [PATCH 1/1] 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. --- ginac/inifcns_nstdsums.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) 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 ) { -- 2.44.0