]> www.ginac.de Git - ginac.git/commitdiff
numeric denominators weren't made unit normal in fraction cancellation
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 30 Jun 2003 22:03:06 +0000 (22:03 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 30 Jun 2003 22:03:06 +0000 (22:03 +0000)
ginac/normal.cpp

index fad5a9d4257176b52bb4977010484de1bfb635e0..2fd6bfb0d26c0b592130ee08b30d910a7075e269 100644 (file)
@@ -1826,13 +1826,20 @@ static ex frac_cancel(const ex &n, const ex &d)
 
        // Make denominator unit normal (i.e. coefficient of first symbol
        // as defined by get_first_symbol() is made positive)
-       const symbol *x;
-       if (get_first_symbol(den, x)) {
-               GINAC_ASSERT(is_exactly_a<numeric>(den.unit(*x)));
-               if (ex_to<numeric>(den.unit(*x)).is_negative()) {
+       if (is_exactly_a<numeric>(den)) {
+               if (ex_to<numeric>(den).is_negative()) {
                        num *= _ex_1;
                        den *= _ex_1;
                }
+       } else {
+               const symbol *x;
+               if (get_first_symbol(den, x)) {
+                       GINAC_ASSERT(is_exactly_a<numeric>(den.unit(*x)));
+                       if (ex_to<numeric>(den.unit(*x)).is_negative()) {
+                               num *= _ex_1;
+                               den *= _ex_1;
+                       }
+               }
        }
 
        // Return result as list