pgcd(): avoid infinite loop if the first GCD candidate coincides with GCD
authorAlexei Sheplyakov <alexei.sheplyakov@gmail.com>
Mon, 17 May 2010 22:17:26 +0000 (00:17 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Mon, 17 May 2010 22:44:23 +0000 (00:44 +0200)
commitf28f24cf1228f0fa9cb0889d87a3f4039587ff92
tree338b0e5862e0609c65caf383d339fb1ea55b9bb5
parenta7c70c1f9e0b906a8b95bffb04bc1266eb59f39d
pgcd(): avoid infinite loop if the first GCD candidate coincides with GCD

136 if (H_lcoeff.is_equal(lc_gcd)) {
137 if ((Hprev-H).expand().smod(pn).is_zero()) // (*)
138 continue;

The check (*) can result in infinite loop if the (very) first GCD candidate
gives the correct GCD: any subsequent iterations give the same result, so
Hprev and H will be equal (hence the infinite loop). That check is not very
useful (AFAIR I was trying to avoid extra division checks), so let's remove it.
check/Makefile.am
check/pgcd_infinite_loop.cpp [new file with mode: 0644]
ginac/polynomial/pgcd.cpp