X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fpolynomial%2Fmgcd.cpp;h=9eb535aff1dfad2e53e4e89e59a3bbaec5e8a930;hp=901f075a943f467355752a961183c62d83d0ad56;hb=265e5f9537e128887655119fc4cc8d3a46f3dcff;hpb=5375260fd145e474246b7a3cce0fc2e667bd4ec8 diff --git a/ginac/polynomial/mgcd.cpp b/ginac/polynomial/mgcd.cpp index 901f075a..9eb535af 100644 --- a/ginac/polynomial/mgcd.cpp +++ b/ginac/polynomial/mgcd.cpp @@ -3,7 +3,7 @@ * Chinese remainder algorithm. */ /* - * GiNaC Copyright (C) 1999-2010 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +40,7 @@ static cln::cl_I extract_integer_content(ex& Apr, const ex& A) { static const cln::cl_I n1(1); const numeric icont_ = A.integer_content(); + GINAC_ASSERT(cln::instanceof(icont_.to_cl_N(), cln::cl_RA_ring)); if (cln::instanceof(icont_.to_cl_N(), cln::cl_I_ring)) { const cln::cl_I icont = cln::the(icont_.to_cl_N()); if (icont != 1) { @@ -49,14 +50,12 @@ static cln::cl_I extract_integer_content(ex& Apr, const ex& A) Apr = A; return n1; } - } - if (cln::instanceof(icont_.to_cl_N(), cln::cl_RA_ring)) { + } else { Apr = (A/icont_).expand(); // A is a polynomail over rationals, so GCD is defined // up to arbitrary rational number. return n1; } - GINAC_ASSERT(NULL == "expected polynomial over integers or rationals"); } ex chinrem_gcd(const ex& A_, const ex& B_, const exvector& vars)