From 92bbad01824400ab31e552dfecdf0ebfb6f19b43 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Mon, 30 Jun 2003 22:03:06 +0000 Subject: [PATCH] numeric denominators weren't made unit normal in fraction cancellation --- ginac/normal.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 -- 2.49.0