]> www.ginac.de Git - ginac.git/blobdiff - ginac/power.cpp
Fix bug in power::expand() with the overall coefficient.
[ginac.git] / ginac / power.cpp
index 19b31034e64aea7ad61aca05c0f73f9a15b9a46a..ba7a66f4bc77cb912947fa06975b2ee801e304d9 100644 (file)
@@ -809,9 +809,10 @@ ex power::expand(unsigned options) const
                ex coeff=(possign? _ex1 : _ex_1);
                if (m.overall_coeff.info(info_flags::positive) && m.overall_coeff != _ex1)
                        prodseq.push_back(pow(m.overall_coeff, exponent));
-               else if (m.overall_coeff.info(info_flags::negative) && m.overall_coeff != _ex_1)
+               else if (m.overall_coeff.info(info_flags::negative) && m.overall_coeff != _ex_1) {
                        prodseq.push_back(pow(-m.overall_coeff, exponent));
-               else
+                       coeff = -coeff;
+               } else
                        coeff *= m.overall_coeff;
 
                // If positive/negative factors are found, then extract them.