]> www.ginac.de Git - ginac.git/commitdiff
Fix G3_evalf and G3_eval for real and negative x.
authorStefan Weinzierl <stefanw@thep.physik.uni-mainz.de>
Sun, 12 Jan 2014 22:19:56 +0000 (22:19 +0000)
committerRichard Kreckel <kreckel@ginac.de>
Sun, 12 Jan 2014 22:19:56 +0000 (22:19 +0000)
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

index 043d93a8a081678bd25944e6e54cd66b0bde2570..c33a4cf8370d22020e302b0c08e1ade04f6a24f1 100644 (file)
@@ -1360,12 +1360,16 @@ static ex G3_evalf(const ex& x_, const ex& s_, const ex& y)
                        all_zero = false;
                }
                if ( ex_to<numeric>(*itx).is_real() ) {
                        all_zero = false;
                }
                if ( ex_to<numeric>(*itx).is_real() ) {
-                       if ( *its >= 0 ) {
+                       if ( ex_to<numeric>(*itx).is_positive() ) {
+                               if ( *its >= 0 ) {
+                                       sn.push_back(1);
+                               }
+                               else {
+                                       sn.push_back(-1);
+                               }
+                       } else {
                                sn.push_back(1);
                        }
                                sn.push_back(1);
                        }
-                       else {
-                               sn.push_back(-1);
-                       }
                }
                else {
                        if ( ex_to<numeric>(*itx).imag() > 0 ) {
                }
                else {
                        if ( ex_to<numeric>(*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<numeric>(*itx).is_real() ) {
                        all_zero = false;
                }
                if ( ex_to<numeric>(*itx).is_real() ) {
-                       if ( *its >= 0 ) {
+                       if ( ex_to<numeric>(*itx).is_positive() ) {
+                               if ( *its >= 0 ) {
+                                       sn.push_back(1);
+                               }
+                               else {
+                                       sn.push_back(-1);
+                               }
+                       } else {
                                sn.push_back(1);
                        }
                                sn.push_back(1);
                        }
-                       else {
-                               sn.push_back(-1);
-                       }
                }
                else {
                        if ( ex_to<numeric>(*itx).imag() > 0 ) {
                }
                else {
                        if ( ex_to<numeric>(*itx).imag() > 0 ) {