/[cln]/tests/exam_I_sqrtp.cc
ViewVC logotype

Contents of /tests/exam_I_sqrtp.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Fri Jan 28 11:37:44 2000 UTC (13 years, 3 months ago) by kreckel
Branch: cln, MAIN
CVS Tags: cln_1-1-1, cln_1-1-0, cln_1-1-3, cln_1-1-2, cln_1-1-5, cln_1-1-4, cln_1-1-7, cln_1-1-6, cln_1-2-2, cln_1-1-8, cln_1-2-0, cln_1-2-1, release-1_0_3, cln_1-1-9, cln_1-1-11, cln_1-1-10, cln_1-1-13, cln_1-1-12, cln_1-1_maintenance-branchpoint, HEAD
Branch point for: cln_1-1
Changes since 1.1: +0 -0 lines
- CLN vanilla release 1.0.3.

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

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15