]> 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 16:45:52 +0000 (17:45 +0100)
commit3d09388a8ea144a19949c216fae43ccba92e47aa
tree4eb3f7ae3541b4cc87181a43b27f03df0c113839
parent079c558d4f9758cd2777a2808a02d64cb1f70c8e
[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.
check/bugme_chinrem_gcd.cpp
ginac/polynomial/mgcd.cpp