From: Richard Kreckel Date: Wed, 29 Jul 2020 22:20:22 +0000 (+0200) Subject: [BUGFIX] factor_multivariate(): respect unit... X-Git-Tag: release_1-7-11~6 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=c2ef6cb074a85957bd684337552fe9d84451d307;ds=inline [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. --- 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