From: Richard Kreckel Date: Sat, 10 Oct 2015 09:02:17 +0000 (+0200) Subject: Fix algebraic power::has() for larger integer exponents. X-Git-Tag: ginac_1-6-6~14 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=12abd5eb38a5c4ad6eb74201df2977b4abad3f52;hp=725fa0199bdf612f099a76fa2c36424554a71ff8 Fix algebraic power::has() for larger integer exponents. There is no need to overflow integers in (x^2147483648).has(x^2). --- diff --git a/ginac/power.cpp b/ginac/power.cpp index 1a4f57db..8ec6380b 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -627,14 +627,12 @@ bool power::has(const ex & other, unsigned options) const return basic::has(other, options); if (exponent.info(info_flags::posint) && other.op(1).info(info_flags::posint) - && ex_to(exponent).to_int() - > ex_to(other.op(1)).to_int() + && ex_to(exponent) > ex_to(other.op(1)) && basis.match(other.op(0))) return true; if (exponent.info(info_flags::negint) && other.op(1).info(info_flags::negint) - && ex_to(exponent).to_int() - < ex_to(other.op(1)).to_int() + && ex_to(exponent) < ex_to(other.op(1)) && basis.match(other.op(0))) return true; return basic::has(other, options);