]> www.ginac.de Git - ginac.git/blobdiff - ginac/mul.cpp
Replace idx_is_not functor by a C++11 lambda.
[ginac.git] / ginac / mul.cpp
index 943095bb3a9c0e1a88aa023c37916bc701178eae..c899ee11f25248cc0edd547f8149bd1a556c512f 100644 (file)
@@ -469,7 +469,7 @@ ex mul::coeff(const ex & s, int n) const
 ex mul::eval(int level) const
 {
        epvector evaled = evalchildren(level);
-       if (!evaled.empty()) {
+       if (unlikely(!evaled.empty())) {
                // do more evaluation later
                return (new mul(std::move(evaled), overall_coeff))->
                        setflag(status_flags::dynallocated);
@@ -1047,10 +1047,9 @@ void mul::combine_overall_coeff(const ex & c1, const ex & c2)
 bool mul::can_make_flat(const expair & p) const
 {
        GINAC_ASSERT(is_exactly_a<numeric>(p.coeff));
-       // this assertion will probably fail somewhere
-       // it would require a more careful make_flat, obeying the power laws
-       // probably should return true only if p.coeff is integer
-       return ex_to<numeric>(p.coeff).is_equal(*_num1_p);
+
+       // (x*y)^c == x^c*y^c  if c ∈ ℤ
+       return p.coeff.info(info_flags::integer);
 }
 
 bool mul::can_be_further_expanded(const ex & e)