]> www.ginac.de Git - ginac.git/commitdiff
'x+I' was missing the plus sign in the C source output
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 20 Feb 2003 22:40:45 +0000 (22:40 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 20 Feb 2003 22:40:45 +0000 (22:40 +0000)
ginac/add.cpp

index 9646991592e711d52841deb9f57536fb0a68a3ca..b409513caade806148f468a20de2354ce52207f3 100644 (file)
@@ -145,14 +145,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
-                        && (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)
-                        || 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());
                }