]> www.ginac.de Git - ginac.git/commit
[bugfix] chinrem_gcd: handle polynomials over rationals properly.
authorAlexei Sheplyakov <alexei.sheplyakov@gmail.com>
Tue, 23 Nov 2010 16:45:52 +0000 (17:45 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Tue, 23 Nov 2010 17:52:23 +0000 (18:52 +0100)
commitd41f7533018d9f9444c98466432e4d84deedaa04
tree09bb7dc18d6a2cfc781dce1a93329b2384837999
parent1d73fed17debbc88819dc7f84a4a2e608d8eb978
[bugfix] chinrem_gcd: handle polynomials over rationals properly.

* extract_integer_content():
  integer_content() can also return a rational number, e.g if the expression
  is a polynomial over rationals (in this case expr/content is polynomial
  over integers with integer content being 1). Therefore check if
  integer_content() is really an integer (and if it's not just return 1,
  GCD for polynomials over a field is defined up to arbitrary element of
  the field).

  This fixes possible segfault when computing GCD of polynomials over
  rationals (this is not theoretical, see the added test case).

Thanks to Ernst Moritz Hahn for reporting this bug.
(cherry picked from commit 3d09388a8ea144a19949c216fae43ccba92e47aa)
check/bugme_chinrem_gcd.cpp
ginac/polynomial/mgcd.cpp