+ if (precedence <= level)
+ c.s << ")";
+
+ } else {
+
+ if (precedence <= level)
+ c.s << "(";
+
+ numeric coeff;
+ bool first = true;
+
+ // First print the overall numeric coefficient, if present
+ if (!overall_coeff.is_zero()) {
+ overall_coeff.print(c, precedence);
+ first = false;
+ }
+
+ // Then proceed with the remaining factors
+ epvector::const_iterator it = seq.begin(), itend = seq.end();
+ while (it != itend) {
+ coeff = ex_to_numeric(it->coeff);
+ if (!first) {
+ if (coeff.csgn() == -1) c.s << '-'; else c.s << '+';
+ } else {
+ if (coeff.csgn() == -1) c.s << '-';
+ first = false;
+ }
+ if (!coeff.is_equal(_num1()) &&
+ !coeff.is_equal(_num_1())) {
+ if (coeff.is_rational()) {
+ if (coeff.is_negative())
+ (-coeff).print(c, precedence);
+ else
+ coeff.print(c, precedence);
+ } else {
+ if (coeff.csgn() == -1)
+ (-coeff).print(c, precedence);
+ else
+ coeff.print(c, precedence);
+ }
+ c.s << '*';
+ }
+ it->rest.print(c, precedence);
+ it++;
+ }
+
+ if (precedence <= level)
+ c.s << ")";
+ }