This file is part of the GNU MP Library test suite.
The GNU MP Library test suite is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
The GNU MP Library test suite is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
/* 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) return 0;
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.