/* Called when g is supposed to be gcd(a,b), and g = s a + t b. */ staticint
gcdext_valid_p (const mpz_t a, const mpz_t b, const mpz_t g, const mpz_t s, const mpz_t t)
{
mpz_t ta, tb, r;
/* It's not clear that gcd(0,0) is well defined, but we allow it and
require that gcd(0,0) = 0. */ if (mpz_sgn (g) < 0) return0;
if (mpz_sgn (a) == 0)
{ /* Must have g == abs (b). Any value for s is in some sense "correct",
but it makes sense to require that s == 0, t = sgn (b)*/ return mpz_cmpabs (g, b) == 0
&& mpz_sgn (s) == 0 && mpz_cmp_si (t, mpz_sgn (b)) == 0;
} elseif (mpz_sgn (b) == 0)
{ /* Must have g == abs (a), s == sign (a), t = 0 */ return mpz_cmpabs (g, a) == 0
&& mpz_cmp_si (s, mpz_sgn (a)) == 0 && mpz_sgn (t) == 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.