diff options
author | Linus Nordberg <linus@nordberg.se> | 1999-04-29 11:43:46 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 1999-04-29 11:43:46 +0200 |
commit | f7dc37aec75d506f630a80fc8ed80fecbe2840de (patch) | |
tree | 297f03569acc2b0a413b1b4246e93884045c1a81 | |
parent | b0c4502ba0979360835547681b628288db484abe (diff) | |
download | gmp-f7dc37aec75d506f630a80fc8ed80fecbe2840de.tar.gz |
Separate lose figures.
-rw-r--r-- | tests/rand/ChangeLog | 3 | ||||
-rw-r--r-- | tests/rand/findcl.c | 30 |
2 files changed, 22 insertions, 11 deletions
diff --git a/tests/rand/ChangeLog b/tests/rand/ChangeLog index 801ab1e28..c4b672dc7 100644 --- a/tests/rand/ChangeLog +++ b/tests/rand/ChangeLog @@ -1,6 +1,7 @@ 1999-04-29 Linus Nordberg <linus@swox.se> - * findcl.c (main): Add option '-i' for interval factor. + * findcl.c (main): Add option '-i' for interval factor. Separate + v and merit lose figures. 1999-04-28 Linus Nordberg <linus@swox.se> diff --git a/tests/rand/findcl.c b/tests/rand/findcl.c index a53d07d8d..44abd7a0a 100644 --- a/tests/rand/findcl.c +++ b/tests/rand/findcl.c @@ -50,7 +50,7 @@ main (int argc, char *argv[]) { const char usage[] = "usage: findcl [-a start_a] [-d] [-i interval-fact] m [low_merit [high_merit]]\n"; int f; - int lose, best; + int v_lose, m_lose, v_best, m_best; int c; int debug = 1; int have_start_a = 0; @@ -161,26 +161,28 @@ main (int argc, char *argv[]) rem = mpz_mod_ui (z_tmp, a, 8); mpz_add_ui (a, a, 8 + (5 - rem)); - best = 2*(DIMS-1); + v_best = m_best = 2*(DIMS-1); for (; mpz_cmp (a, ulim) <= 0; mpz_add (a, a, interval)) { /* TODO: Reject 'a' with "binary or decimal simple, regular pattern." */ /* run spectral test */ spectral_test (v, DIMS, a, m); - for (f = 0, lose = 0, cnt_high_merit = DIMS-1; f < DIMS-1; f++) + for (f = 0, v_lose = m_lose = 0, cnt_high_merit = DIMS-1; f < DIMS-1; f++) { merit (f_merit, f + 2, v[f], m); - if (mpf_cmp_ui (v[f], 1 << (30 / (f + 2) + (f == 2))) < 0 - || mpf_cmp (f_merit, low_merit) < 0) - lose++; + if (mpf_cmp_ui (v[f], 1 << (30 / (f + 2) + (f == 2))) < 0) + v_lose++; + + if (mpf_cmp (f_merit, low_merit) < 0) + m_lose++; if (mpf_cmp (f_merit, high_merit) >= 0) cnt_high_merit--; } - if (0 == lose) + if (0 == v_lose && 0 == m_lose) { mpz_out_str (stdout, 10, a); puts (""); @@ -189,10 +191,18 @@ main (int argc, char *argv[]) break; /* leave loop */ } - if (lose < best) + if (v_lose < v_best) { - best = lose; - printf ("best (lose=%d): ", lose); + v_best = v_lose; + printf ("best (v_lose=%d; m_lose=%d): ", v_lose, m_lose); + mpz_out_str (stdout, 10, a); + puts (""); + fflush (stdout); + } + if (m_lose < m_best) + { + m_best = m_lose; + printf ("best (v_lose=%d; m_lose=%d): ", v_lose, m_lose); mpz_out_str (stdout, 10, a); puts (""); fflush (stdout); |