]> www.ginac.de Git - ginac.git/commitdiff
synced to 1.0
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 20 Feb 2003 22:42:31 +0000 (22:42 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 20 Feb 2003 22:42:31 +0000 (22:42 +0000)
ginac/add.cpp

index 706013a3905f3ca60e4e45c121b8aa9cfcdefb09..9edbf13947304b8f26756e06f3119522ccd926c1 100644 (file)
@@ -144,14 +144,14 @@ void add::print(const print_context & c, unsigned level) const
                        // 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
                        // 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
-                        && (is_a<print_csrc_cl_N>(c)  // sign inside ctor arguments
+                        && (is_a<print_csrc_cl_N>(c) || !it->coeff.info(info_flags::real)  // 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 << "+";
                }
        
                if (!overall_coeff.is_zero()) {
                        if (overall_coeff.info(info_flags::positive)
                          || !(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 << "+";
                }
        
                if (!overall_coeff.is_zero()) {
                        if (overall_coeff.info(info_flags::positive)
-                        || is_a<print_csrc_cl_N>(c))  // sign inside ctor argument
+                        || is_a<print_csrc_cl_N>(c) || !overall_coeff.info(info_flags::real))  // sign inside ctor argument
                                c.s << '+';
                        overall_coeff.print(c, precedence());
                }
                                c.s << '+';
                        overall_coeff.print(c, precedence());
                }