]> 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:23 +0000 (17:18 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Tue, 27 Aug 2002 17:18:23 +0000 (17:18 +0000)
ginac/add.cpp

index 36dafd8f7e571adcc5ec68adf95c896164ef2090..f7ca4d2548f00831b9eedb44b6df2c5268f07fe9 100644 (file)
@@ -142,9 +142,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 << "+";
                }