]> www.ginac.de Git - ginac.git/commitdiff
Fixed bug. G() ignored the imaginary parts of the arguments.
authorJens Vollinga <jensv@nikhef.nl>
Mon, 8 Sep 2008 16:17:51 +0000 (18:17 +0200)
committerJens Vollinga <jensv@nikhef.nl>
Mon, 8 Sep 2008 17:24:10 +0000 (19:24 +0200)
ginac/inifcns_nstdsums.cpp

index 43add2803c969b4107457ec8f995914d368d6021..b70e00101083bf4e1f0a3c2c46a3d6fb6a54adab 100644 (file)
@@ -1201,7 +1201,12 @@ static ex G2_evalf(const ex& x_, const ex& y)
                if (*it != _ex0) {
                        all_zero = false;
                }
-               s.append(+1);
+               if ( !ex_to<numeric>(*it).is_real() && ex_to<numeric>(*it).imag() < 0 ) {
+                       s.append(-1);
+               }
+               else {
+                       s.append(+1);
+               }
        }
        if (all_zero) {
                return pow(log(y), x.nops()) / factorial(x.nops());
@@ -1237,7 +1242,12 @@ static ex G2_eval(const ex& x_, const ex& y)
                if (*it != _ex0) {
                        all_zero = false;
                }
-               s.append(+1);
+               if ( !ex_to<numeric>(*it).is_real() && ex_to<numeric>(*it).imag() < 0 ) {
+                       s.append(-1);
+               }
+               else {
+                       s.append(+1);
+               }
        }
        if (all_zero) {
                return pow(log(y), x.nops()) / factorial(x.nops());
@@ -1290,10 +1300,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<numeric>(*itx).is_real() ) {
+                       if ( *its >= 0 ) {
+                               sn.append(+1);
+                       }
+                       else {
+                               sn.append(-1);
+                       }
+               }
+               else {
+                       if ( ex_to<numeric>(*itx).imag() > 0 ) {
+                               sn.append(+1);
+                       }
+                       else {
+                               sn.append(-1);
+                       }
                }
        }
        if (all_zero) {
@@ -1337,10 +1358,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<numeric>(*itx).is_real() ) {
+                       if ( *its >= 0 ) {
+                               sn.append(+1);
+                       }
+                       else {
+                               sn.append(-1);
+                       }
+               }
+               else {
+                       if ( ex_to<numeric>(*itx).imag() > 0 ) {
+                               sn.append(+1);
+                       }
+                       else {
+                               sn.append(-1);
+                       }
                }
        }
        if (all_zero) {