static const string srep("\
792*z^8*w^4*x^3*y^4*u^7 + 24*z^4*w^4*x^2*y^3*u^4 \
-+ 264*z^8*w^3*x^2*y^7*u^5 + 198*z^4*w^5*x^5*y*u^6 \
-+ 110*z^2*w^3*x^5*y^4*u^6 - 120*z^8*w*x^4*u^6 \
++ 264*z^8*w^3*x^2*y^7*u^5 + 198*z^4*w^5*x^5*y*u^6 \
++ 110*z^2*w^3*x^5*y^4*u^6 - 120*z^8*w*x^4*u^6 \
- 480*z^5*w*x^4*y^6*u^8 - 720*z^7*x^3*y^3*u^7 \
+ 165*z^4*w^2*x^4*y*u^5 + 450*z^8*w^6*x^2*y*u^8 \
+ 40*z^2*w^3*x^3*y^3*u^6 - 288*z^7*w^2*x^3*y^6*u^6 \
int main(int argc, char** argv)
{
- cout << "Checking for more pgcd() bugs (infinite loop) ... " << flush;
+ cout << "Checking for more pgcd() bugs (infinite loop, miscalculation) ... " << flush;
parser the_parser;
ex e = the_parser(srep);
const symbol x = ex_to<symbol>(the_parser.get_syms()["x"]);
ex g = gcd(e, e.diff(x));
+ ex should_be = the_parser(string("u^4*z^2"));
+ if (!(g-should_be).expand().is_zero()) {
+ cout << "GCD was miscomputed. " << flush;
+ return 1;
+ }
cout << "not found. " << flush;
- cout << g << endl << flush;
return 0;
}