From c2ef6cb074a85957bd684337552fe9d84451d307 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Thu, 30 Jul 2020 00:20:22 +0200 Subject: [PATCH] [BUGFIX] factor_multivariate(): respect unit... ...if the content of polynomial isn't a number and needs to be factored. And while at it, reduce the scope of a local variable. --- ginac/factor.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ginac/factor.cpp b/ginac/factor.cpp index 2878a2c1..bb20589b 100644 --- a/ginac/factor.cpp +++ b/ginac/factor.cpp @@ -2229,14 +2229,13 @@ static ex factor_sqrfree(const ex& poly); */ static ex factor_multivariate(const ex& poly, const exset& syms) { - exset::const_iterator s; const ex& x = *syms.begin(); // make polynomial primitive ex unit, cont, pp; poly.unitcontprim(x, unit, cont, pp); if ( !is_a(cont) ) { - return factor_sqrfree(cont) * factor_sqrfree(pp); + return unit * factor_sqrfree(cont) * factor_sqrfree(pp); } // factor leading coefficient @@ -2309,7 +2308,7 @@ static ex factor_multivariate(const ex& poly, const exset& syms) vector ftilde(vnlst.nops()-1); for ( size_t i=0; i epv; - s = syms.begin(); + auto s = syms.begin(); ++s; for ( size_t i=0; i