- if (is_exactly_a<numeric>(cit->rest)) {
- distrseq.push_back(m.combine_pair_with_coeff_to_pair(*cit, n));
- } else {
- // it is safe not to call mul::combine_pair_with_coeff_to_pair()
- // since n is an integer
- numeric new_coeff = ex_to<numeric>(cit->coeff).mul(n);
- if (from_expand && is_exactly_a<add>(cit->rest) && new_coeff.is_pos_integer()) {
- // this happens when e.g. (a+b)^(1/2) gets squared and
- // the resulting product needs to be reexpanded
- need_reexpand = true;
- }
- distrseq.push_back(expair(cit->rest, new_coeff));
+ expair p = m.combine_pair_with_coeff_to_pair(*cit, n);
+ if (from_expand && is_exactly_a<add>(cit->rest) && ex_to<numeric>(p.coeff).is_pos_integer()) {
+ // this happens when e.g. (a+b)^(1/2) gets squared and
+ // the resulting product needs to be reexpanded
+ need_reexpand = true;