Within mLi_numeric, set signs of the imaginary parts correctly for G_numeric.
[ginac.git] / ginac / inifcns_nstdsums.cpp
index 7487b31430de89c01871d8b8911192516e5ecf21..043d93a8a081678bd25944e6e54cd66b0bde2570 100644 (file)
@@ -1201,9 +1201,14 @@ ex mLi_numeric(const lst& m, const lst& x)
                        s.push_back(1);
                }
                const cln::cl_N xi = ex_to<numeric>(*itx).to_cl_N();
-               newx.push_back(factor/xi);
                factor = factor/xi;
-               s.push_back(1);
+               newx.push_back(factor);
+               if ( !instanceof(factor, cln::cl_R_ring) && imagpart(factor) < 0 ) {
+                       s.push_back(-1);
+               }
+               else {
+                       s.push_back(1);
+               }
        }
        return numeric(cln::cl_N(1 & m.nops() ? - 1 : 1)*G_numeric(newx, s, cln::cl_N(1)));
 }