From: Christian Bauer Date: Mon, 30 Jun 2003 22:03:06 +0000 (+0000) Subject: numeric denominators weren't made unit normal in fraction cancellation X-Git-Tag: release_1-1-2~14 X-Git-Url: https://www.ginac.de/ginac.git/tutorial/ginac.git?a=commitdiff_plain;h=92bbad01824400ab31e552dfecdf0ebfb6f19b43;p=ginac.git numeric denominators weren't made unit normal in fraction cancellation --- diff --git a/ginac/normal.cpp b/ginac/normal.cpp index fad5a9d4..2fd6bfb0 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -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(den.unit(*x))); - if (ex_to(den.unit(*x)).is_negative()) { + if (is_exactly_a(den)) { + if (ex_to(den).is_negative()) { num *= _ex_1; den *= _ex_1; } + } else { + const symbol *x; + if (get_first_symbol(den, x)) { + GINAC_ASSERT(is_exactly_a(den.unit(*x))); + if (ex_to(den.unit(*x)).is_negative()) { + num *= _ex_1; + den *= _ex_1; + } + } } // Return result as list