]> www.ginac.de Git - ginac.git/commitdiff
* Fix CLN output of -2*a-2*b. (Chris Dams)
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Tue, 27 Aug 2002 17:18:07 +0000 (17:18 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Tue, 27 Aug 2002 17:18:07 +0000 (17:18 +0000)
ginac/add.cpp

index 821649d245b7e443f7de479fd05a2d7d079bd2ee..7c496bc8d32189f951a7a684d5153f1440d2c2bb 100644 (file)
@@ -141,9 +141,11 @@ void add::print(const print_context & c, unsigned level) const
                                it->rest.print(c, precedence());
                        }
                
-                       // Separator is "+", except if the following expression would have a leading minus sign
+                       // Separator is "+", except if the following expression would have a leading minus sign or the sign is sitting in parenthesis (as in a ctor)
                        ++it;
-                       if (it != itend && !(it->coeff.info(info_flags::negative) || (it->coeff.is_equal(_num1) && is_exactly_a<numeric>(it->rest) && it->rest.info(info_flags::negative))))
+                       if (it != itend
+                               && (is_a<print_csrc_cl_N>(c)  // sign inside ctor arguments
+                                       || !(it->coeff.info(info_flags::negative) || (it->coeff.is_equal(_num1) && is_exactly_a<numeric>(it->rest) && it->rest.info(info_flags::negative)))))
                                c.s << "+";
                }