From 6d9c698cd0d56178bb28f7c6ae92b2e516ce26c1 Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Mon, 26 Feb 2007 17:08:48 +0300 Subject: [PATCH] Improve mul::degree so that degree(c*x^(-1), x^(-1)) gives correct result In ginsh: degree(x^(-1), x^(-1)); 1 degree(c*x^(-1), x^(-1)); 0 Now degree (and ldegree) should work correct with such arguments. Note: degree() is still inconsistent, i.e. degree(c*x^(-2), x^(-1)); 0 --- ginac/mul.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ginac/mul.cpp b/ginac/mul.cpp index ab1a042b..e1d5e02e 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -317,7 +317,7 @@ int mul::degree(const ex & s) const epvector::const_iterator i = seq.begin(), end = seq.end(); while (i != end) { if (ex_to(i->coeff).is_integer()) - deg_sum += i->rest.degree(s) * ex_to(i->coeff).to_int(); + deg_sum += recombine_pair_to_ex(*i).degree(s); ++i; } return deg_sum; @@ -330,7 +330,7 @@ int mul::ldegree(const ex & s) const epvector::const_iterator i = seq.begin(), end = seq.end(); while (i != end) { if (ex_to(i->coeff).is_integer()) - deg_sum += i->rest.ldegree(s) * ex_to(i->coeff).to_int(); + deg_sum += recombine_pair_to_ex(*i).ldegree(s); ++i; } return deg_sum; -- 2.49.0