You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
713 B

25 years ago
  1. #include "test_I.h"
  2. #define floor(a,b) ((a) / (b))
  3. int test_sqrtp (void)
  4. {
  5. int error = 0;
  6. // As our algorithm for sqrtp does pre-filtering mod (64*63*65*11),
  7. // we check that no square is thrown away by this pre-filtering.
  8. {
  9. uintL a, b, c, d;
  10. for (a = 0; a <= floor(64,2); a++)
  11. for (b = 0; b <= floor(63,2); b++)
  12. for (c = 0; c <= floor(65,2); c++)
  13. for (d = 0; d <= floor(11,2); d++) {
  14. // Produce a number x == a mod 64, x == b mod 63,
  15. // x == c mod 65, x == d mod 11, and square it.
  16. uintL x = 1306305*a + 1967680*b + 133056*c + 2358720*d;
  17. x = x % 2882880; // not strictly necessary
  18. cl_I w;
  19. ASSERT4(sqrtp(expt_pos(x,2),&w) && w == x, a,b,c,d);
  20. }
  21. }
  22. return error;
  23. }