Copyright 2000-2002 Free Software Foundation, Inc.
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/. */
#include <stdio.h> #include <stdlib.h>
#include"gmp-impl.h" #include"tests.h"
#include"mpn/perfsqr.h"
/* check_modulo() exercises mpz_perfect_square_p on squares which cover each possible quadratic residue to each divisor used within mpn_perfect_square_p, ensuring those residues aren't incorrectly claimed to be non-residues.
Each divisor is taken separately. It's arranged that n is congruent to 0 modulo the other divisors, 0 of course being a quadratic residue to any modulus.
The values "(j*others)^2" cover all quadratic residues mod divisor[i], but in no particular order. j is run from 1<=j<=divisor[i] so that zero
is excluded. A literal n==0 doesn't reach the residue tests. */
/* product of all divisors */
mpz_set_ui (alldiv, 1L); for (i = 0; i < numberof (divisor); i++)
mpz_mul_ui (alldiv, alldiv, divisor[i]);
for (i = 0; i < numberof (divisor); i++)
{ /* product of all divisors except i */
mpz_set_ui (others, 1L); for (j = 0; j < numberof (divisor); j++) if (i != j)
mpz_mul_ui (others, others, divisor[j]);
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.