From 3bdaf761e882dbed97e60a7078df641850349c7e Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Tue, 27 Aug 2002 17:18:07 +0000 Subject: [PATCH] * Fix CLN output of -2*a-2*b. (Chris Dams) --- ginac/add.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ginac/add.cpp b/ginac/add.cpp index 821649d2..7c496bc8 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -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(it->rest) && it->rest.info(info_flags::negative)))) + if (it != itend + && (is_a(c) // sign inside ctor arguments + || !(it->coeff.info(info_flags::negative) || (it->coeff.is_equal(_num1) && is_exactly_a(it->rest) && it->rest.info(info_flags::negative))))) c.s << "+"; } -- 2.44.0