- if ((i->coeff).info(info_flags::real))
- v.push_back(expair((i->rest).real_part(), i->coeff));
- else {
+ if ((i->coeff).info(info_flags::real)) {
+ ex rp = (i->rest).real_part();
+ if (!rp.is_zero())
+ v.push_back(expair(rp, i->coeff));
+ } else {