]> www.ginac.de Git - ginac.git/commit
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:17:26 +0000 (00:17 +0200)
commit8fcaff0d29e20d570c2936a27ce110326b76390e
tree285a46358f274eaa13400ba5f28c0e8646669dfc
parent0c1db90c39613c27a088b760d68e8d59d4a12ee3
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