From 12abd5eb38a5c4ad6eb74201df2977b4abad3f52 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Sat, 10 Oct 2015 11:02:17 +0200 Subject: [PATCH 1/1] Fix algebraic power::has() for larger integer exponents. There is no need to overflow integers in (x^2147483648).has(x^2). --- ginac/power.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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); -- 2.44.0