]> www.ginac.de Git - ginac.git/blobdiff - ginac/normal.cpp
[bugfix] fix elusive bug in quo, rem,...
[ginac.git] / ginac / normal.cpp
index a8a1e1eb1bd3f7282418eff3160f2ba1a25114e6..a1e2de48c9f598fd09c915dd026e16211d2fde70 100644 (file)
@@ -290,8 +290,13 @@ static ex multiply_lcm(const ex &e, const numeric &lcm)
        } else if (is_exactly_a<power>(e)) {
                if (is_a<symbol>(e.op(0)))
                        return e * lcm;
        } else if (is_exactly_a<power>(e)) {
                if (is_a<symbol>(e.op(0)))
                        return e * lcm;
-               else
-                       return pow(multiply_lcm(e.op(0), lcm.power(ex_to<numeric>(e.op(1)).inverse())), e.op(1));
+               else {
+                       numeric root_of_lcm = lcm.power(ex_to<numeric>(e.op(1)).inverse());
+                       if (root_of_lcm.is_rational())
+                               return pow(multiply_lcm(e.op(0), root_of_lcm), e.op(1));
+                       else
+                               return e * lcm;
+               }
        } else
                return e * lcm;
 }
        } else
                return e * lcm;
 }