]> www.ginac.de Git - ginac.git/blobdiff - ginac/power.cpp
* Fix thinkos in print_csrc context.
[ginac.git] / ginac / power.cpp
index 78c9c9696d14303b468a4f3b1c69b460560a314a..abbee766cd6b5afa4e16f14b63406a35da2445fb 100644 (file)
@@ -139,7 +139,7 @@ void power::print(const print_context & c, unsigned level) const
                        c.s << ')';
 
                // <expr>^-1 is printed as "1.0/<expr>" or with the recip() function of CLN
-               } else if (exponent.compare(_num_1) == 0) {
+               } else if (exponent.is_equal(_ex_1)) {
                        if (is_a<print_csrc_cl_N>(c))
                                c.s << "recip(";
                        else
@@ -159,6 +159,14 @@ void power::print(const print_context & c, unsigned level) const
                        c.s << ')';
                }
 
+       } else if (is_a<print_python_repr>(c)) {
+
+               c.s << class_name() << '(';
+               basis.print(c);
+               c.s << ',';
+               exponent.print(c);
+               c.s << ')';
+
        } else {
 
                if (exponent.is_equal(_ex1_2)) {
@@ -179,7 +187,10 @@ void power::print(const print_context & c, unsigned level) const
                                        c.s << "(";
                        }
                        basis.print(c, precedence());
-                       c.s << '^';
+                       if (is_a<print_python>(c))
+                               c.s << "**";
+                       else
+                               c.s << '^';
                        if (is_a<print_latex>(c))
                                c.s << '{';
                        exponent.print(c, precedence());