aboutsummaryrefslogtreecommitdiff
path: root/src/benchmarks/cfrac
diff options
context:
space:
mode:
Diffstat (limited to 'src/benchmarks/cfrac')
-rw-r--r--src/benchmarks/cfrac/CMakeLists.txt18
-rw-r--r--src/benchmarks/cfrac/README.md5
-rw-r--r--src/benchmarks/cfrac/asm16bit.h39
-rw-r--r--src/benchmarks/cfrac/atop.c61
-rw-r--r--src/benchmarks/cfrac/cfrac.c268
-rw-r--r--src/benchmarks/cfrac/errorp.c27
-rw-r--r--src/benchmarks/cfrac/getopt.c757
-rw-r--r--src/benchmarks/cfrac/getopt.h125
-rw-r--r--src/benchmarks/cfrac/itop.c25
-rw-r--r--src/benchmarks/cfrac/ltop.c25
-rw-r--r--src/benchmarks/cfrac/pabs.c22
-rw-r--r--src/benchmarks/cfrac/padd.c94
-rw-r--r--src/benchmarks/cfrac/pcfrac.c731
-rw-r--r--src/benchmarks/cfrac/pcmp.c68
-rw-r--r--src/benchmarks/cfrac/pconst.c46
-rw-r--r--src/benchmarks/cfrac/pcvt.h32
-rw-r--r--src/benchmarks/cfrac/pdefs.h138
-rw-r--r--src/benchmarks/cfrac/pdivmod.c315
-rw-r--r--src/benchmarks/cfrac/pfactor.c55
-rw-r--r--src/benchmarks/cfrac/pfactor.h62
-rw-r--r--src/benchmarks/cfrac/pfloat.c61
-rw-r--r--src/benchmarks/cfrac/pgcd.c24
-rw-r--r--src/benchmarks/cfrac/phalf.c36
-rw-r--r--src/benchmarks/cfrac/picmp.c41
-rw-r--r--src/benchmarks/cfrac/pidiv.c60
-rw-r--r--src/benchmarks/cfrac/pimod.c48
-rw-r--r--src/benchmarks/cfrac/pio.c165
-rw-r--r--src/benchmarks/cfrac/pmul.c84
-rw-r--r--src/benchmarks/cfrac/pneg.c25
-rw-r--r--src/benchmarks/cfrac/podd.c16
-rw-r--r--src/benchmarks/cfrac/pops.c339
-rw-r--r--src/benchmarks/cfrac/ppowmod.c28
-rw-r--r--src/benchmarks/cfrac/precision.h314
-rw-r--r--src/benchmarks/cfrac/primes.c662
-rw-r--r--src/benchmarks/cfrac/primes.h2
-rw-r--r--src/benchmarks/cfrac/psqrt.c29
-rw-r--r--src/benchmarks/cfrac/psub.c92
-rw-r--r--src/benchmarks/cfrac/ptoa.c71
-rw-r--r--src/benchmarks/cfrac/ptob.c81
-rw-r--r--src/benchmarks/cfrac/ptou.c31
-rw-r--r--src/benchmarks/cfrac/seive.h3
-rw-r--r--src/benchmarks/cfrac/utop.c25
42 files changed, 0 insertions, 5150 deletions
diff --git a/src/benchmarks/cfrac/CMakeLists.txt b/src/benchmarks/cfrac/CMakeLists.txt
deleted file mode 100644
index b84d68c..0000000
--- a/src/benchmarks/cfrac/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-cmake_minimum_required(VERSION 3.0)
-project(cfrac C)
-
-set(CMAKE_BUILD_TYPE "Release")
-
-set(cfrac_sources
- cfrac.c
- pops.c pconst.c pio.c
- pabs.c pneg.c pcmp.c podd.c phalf.c
- padd.c psub.c pmul.c pdivmod.c psqrt.c ppowmod.c
- atop.c ptoa.c itop.c utop.c ptou.c errorp.c
- pfloat.c pidiv.c pimod.c picmp.c
- primes.c pcfrac.c pgcd.c)
-
-add_executable(cfrac ${cfrac_sources})
-target_compile_options(cfrac PRIVATE $<$<C_COMPILER_ID:GNU>:-std=gnu89>)
-target_compile_definitions(cfrac PRIVATE NOMEMOPT=1)
-target_link_libraries(cfrac m)
diff --git a/src/benchmarks/cfrac/README.md b/src/benchmarks/cfrac/README.md
deleted file mode 100644
index 529480a..0000000
--- a/src/benchmarks/cfrac/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-pcfrac: Implementation of the continued fraction factoring algoritm
-
-Every two digits additional appears to double the factoring time
-
-Written by Dave Barrett (barrett%asgard@boulder.Colorado.EDU)
diff --git a/src/benchmarks/cfrac/asm16bit.h b/src/benchmarks/cfrac/asm16bit.h
deleted file mode 100644
index 2fb6e48..0000000
--- a/src/benchmarks/cfrac/asm16bit.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * HP-UX C compiler conventions
- *
- * Args pushed right-to-left; caller pops args on return
- * Function result returned in d0 or d0(msb) d1(lsb) pair
- * Called function must preserve all registers except d0,d1,a0,a1
- * C Registers are allocated from top-to-bottem in text from d7-d2, a5-a2
- */
-#ifdef __STDC__
-extern digit memaddw(digitPtr, digitPtr, digitPtr, posit);
-extern digit memsubw(digitPtr, digitPtr, digitPtr, posit);
-
-extern digit memincw(digitPtr, accumulator);
-extern digit memdecw(digitPtr, accumulator);
-
-extern digit memmulw(digitPtr, digitPtr, posit, digitPtr, posit);
-
-extern digit memdivw(digitPtr, digitPtr, posit, digitPtr);
-extern digit memdivw1(digitPtr, digitPtr, posit, digit);
-extern digit memmulw1(digitPtr, digitPtr, posit, digit);
-extern digit memmodw1(digitPtr, posit, digit);
-
-extern void memlsrw(digitPtr, posit);
-#else
-extern digit memaddw();
-extern digit memsubw();
-
-extern digit memincw();
-extern digit memdecw();
-
-extern digit memmulw();
-
-extern digit memdivw();
-extern digit memdivw1();
-extern digit memmulw1();
-extern digit memmodw1();
-
-extern void memlsrw();
-#endif
diff --git a/src/benchmarks/cfrac/atop.c b/src/benchmarks/cfrac/atop.c
deleted file mode 100644
index 98f132a..0000000
--- a/src/benchmarks/cfrac/atop.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <ctype.h>
-#include "pdefs.h"
-#include "pcvt.h"
-#include "precision.h"
-
-/*
- * ascii to precision (modeled after atoi)
- * leading whitespace skipped
- * an optional leading '-' or '+' followed by digits '0'..'9'
- * leading 0's Ok
- * stops at first unrecognized character
- *
- * Returns: pUndef if an invalid argument (pUndef or nondigit as 1st digit)
- */
-precision atop(chp)
- register char *chp;
-{
- precision res = pUndef;
- precision clump = pUndef;
- int sign = 0;
- register int ch;
- register accumulator temp;
- accumulator x;
- register int i;
-
- if (chp != (char *) 0) {
- while (isspace(*chp)) chp++; /* skip whitespace */
- if (*chp == '-') {
- sign = 1;
- ++chp;
- } else if (*chp == '+') {
- ++chp;
- }
- if (isdigit(ch = * (unsigned char *) chp)) {
- pset(&res, pzero);
- pset(&clump, utop(aDigit));
- do {
- i = aDigitLog-1;
- temp = ch - '0';
- do {
- if (!isdigit(ch = * (unsigned char *) ++chp)) goto atoplast;
- temp = temp * aBase + (ch - '0');
- } while (--i > 0);
- pset(&res, padd(pmul(res, clump), utop(temp)));
- } while (isdigit(ch = * (unsigned char *) ++chp));
- goto atopdone;
-atoplast:
- x = aBase;
- while (i++ < aDigitLog-1) {
- x *= aBase;
- }
- pset(&res, padd(pmul(res, utop(x)), utop(temp)));
-atopdone:
- if (sign) {
- pset(&res, pneg(res));
- }
- }
- }
- pdestroy(clump);
- return presult(res);
-}
diff --git a/src/benchmarks/cfrac/cfrac.c b/src/benchmarks/cfrac/cfrac.c
deleted file mode 100644
index 9185d18..0000000
--- a/src/benchmarks/cfrac/cfrac.c
+++ /dev/null
@@ -1,268 +0,0 @@
-#include <string.h>
-#include <stdio.h>
-#include <math.h> /* for findk */
-
-#if defined(_WIN32)
-#include <windows.h>
-#endif
-
-#include "pdefs.h"
-
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#include "precision.h"
-#include "pfactor.h"
-
-#ifdef __STDC__
-extern unsigned *pfactorbase(precision n, unsigned k,
- unsigned *m, unsigned aborts);
-extern double pomeranceLpow(double n, double alpha);
-#else
-extern unsigned *pfactorbase();
-extern double pomeranceLpow();
-#endif
-
-int verbose = 0;
-int debug = 0;
-
-extern unsigned cfracNabort;
-extern unsigned cfracTsolns;
-extern unsigned cfracPsolns;
-extern unsigned cfracT2solns;
-extern unsigned cfracFsolns;
-
-
-extern unsigned short primes[];
-extern unsigned primesize;
-
-/*
- * Return the value of "f(p,d)" from Knuth's exercise 28
- */
-float pfKnuthEx28(p, d)
- unsigned p;
- precision d;
-{
- register float res;
- precision k = pUndef;
-
- (void) pparm(d);
- if (p == 2) {
- if (peven(d)) {
- pset(&k, phalf(d));
- if (peven(k)) {
- res = 2.0/3.0 + pfKnuthEx28(2,k)/2.0; /* eliminate powers of 2 */
- } else { /* until only one 2 left in d. */
- res = 1.0/3.0; /* independent of (the now odd) k. Wow! */
- }
- } else { /* d now odd */
- pset(&k, phalf(d));
- if (podd(k)) {
- res = 1.0/3.0; /* f(2,4k+3): d%8 == 3 or 7 */
- } else {
- if (podd(phalf(k))) {
- res = 2.0/3.0; /* f(2,8k+5): d%8 == 5 */
- } else {
- res = 4.0/3.0; /* f(2,8k+1): d%8 == 1 */
- }
- }
- }
- } else { /* PART 3: p odd, d could still be even (OK) */
- pset(&k, utop(p));
- if peq(ppowmod(d, phalf(psub(k, pone)), k), pone) {
- res = (float) (p+p) / (((float) p)*p-1.0); /* beware int overflow! */
- } else {
- res = 0.0;
- }
- }
-
- pdestroy(k);
- pdestroy(d);
- if (debug > 1) {
- fprintf(stdout, "f(%u,", p);
- fprintf(stdout, "d) = %9.7f\n", res);
- }
- return res;
-}
-
-float cfrac_logf(unsigned p, precision n, unsigned k)
-{
- register float res;
-
- (void) pparm(n);
-
-#if 0 /* old code for non-float machines; not worth the cost */
- pset(&r, utop(k));
- log2sqrtk = plogb(pipow(r, q >> 1), ptwo);
- fplog2p = (f(p,pmul(r,n),q) * plogb(pipow(utop(p),q),ptwo)+(q>>1))/q;
-#endif
-
- res = pfKnuthEx28(p, pmul(itop(k),n)) * log((double) p);
- /* res -= log((double) k) * 0.5; */
-
- pdestroy(n);
- return res;
-}
-
-/*
- * Find the best value of k for the given n and m.
- *
- * Input/Output:
- * n - the number to factor
- * m - pointer to size of factorbase (0 = select "best" size)
- * aborts - the number of early aborts
- */
-unsigned findk(n, m, aborts, maxk)
- precision n;
- register unsigned *m;
- unsigned aborts, maxk;
-{
- unsigned k, bestk = 0, count, bestcount = 0, maxpm;
- float sum, max = -1.0E+15; /* should be small enough */
- unsigned *p;
- register unsigned i;
- register unsigned short *primePtr;
-
- (void) pparm(n);
-
- for (k = 1; k < maxk; k++) { /* maxk should best be m+m? */
- if (debug) {
- fputs("kN = ", stdout);
- fputp(stdout, pmul(utop(k), n)); putc('\n', stdout);
- }
- count = *m;
- p = pfactorbase(n, k, &count, aborts);
- if (p == (unsigned *) 0) {
- fprintf(stderr, "couldn't compute factor base in findk\n");
- exit(1);
- }
-
- maxpm = p[count-1];
-
- sum = 0.0;
- primePtr = primes;
- while (*primePtr <= maxpm) {
- sum += cfrac_logf((unsigned) *primePtr++, n, k);
- }
- sum -= log((double) k) * 0.5;
- if (verbose > 2) fprintf(stdout, "%u: %5.2f", k, sum);
- if (debug) fprintf(stdout, " log(k)/2=%5.2f", log((double) k) * 0.5);
- if (verbose > 2) {
- fputs("\n", stdout);
- fflush(stdout);
- }
- if (sum > max) {
- max = sum;
- bestk = k;
- bestcount = count;
- }
-#ifndef IGNOREFREE
- free(p);
-#endif
- }
-
- *m = bestcount;
- pdestroy(n);
- return bestk;
-}
-
-extern char *optarg;
-extern int optind;
-
-char *progName;
-
-extern int getopt();
-
-int main(argc, argv)
- int argc;
- char *argv[];
-{
- unsigned m = 0, k = 0;
- unsigned maxCount = 1<<30, count, maxk = 0;
- int ch;
- precision n = pUndef, f = pUndef;
- unsigned aborts = 3;
- unsigned *p;
- double d;
-
- progName = *argv;
-
- while ((ch = getopt(argc, argv, "a:k:i:dv")) != EOF) switch (ch) {
- case 'a':
- aborts = atoi(optarg);
- break;
- case 'k':
- maxk = atoi(optarg);
- break;
- case 'i':
- maxCount = atoi(optarg);
- break;
- case 'd':
- debug++;
- break;
- case 'v':
- verbose++;
- break;
- default:
-usage: fprintf(stderr,
- "usage: %s [-dv] [-a aborts ] [-k maxk ] [-i maxCount ] n [[ m ] k ]\n",
- progName);
- return 1;
- }
- argc -= optind;
- argv += optind;
-
- if (argc == 0) {
- argc = 1;
- static char* argvx[2] = { "17545186520507317056371138836327483792736", NULL };
- argv = argvx;
- }
-
- if (argc < 1 || argc > 3) goto usage;
-
- pset(&n, atop(*argv++)); --argc;
- if (argc) { m = atoi(*argv++); --argc; }
- if (argc) { k = atoi(*argv++); --argc; }
-
- if (k == 0) {
- if (maxk == 0) {
- maxk = m / 2 + 5;
- if (verbose) fprintf(stdout, "maxk = %u\n", maxk);
- }
- k = findk(n, &m, aborts, maxk);
- if (verbose) {
- fprintf(stdout, "k = %u\n", k);
- }
- }
-
- count = maxCount;
-
- pcfracInit(m, k, aborts);
-
- pset(&f, pcfrac(n, &count));
- count = maxCount - count;
- if (verbose) {
- putc('\n', stdout);
- fprintf(stdout, "Iterations : %u\n", count);
- fprintf(stdout, "Early Aborts : %u\n", cfracNabort);
- fprintf(stdout, "Total Partials : %u\n", cfracTsolns);
- fprintf(stdout, "Used Partials : %u\n", cfracT2solns);
- fprintf(stdout, "Full Solutions : %u\n", cfracPsolns);
- fprintf(stdout, "Factor Attempts: %u\n", cfracFsolns);
- }
-
- if (f != pUndef) {
- fputp(stdout, n);
- fputs(" = ", stdout);
- fputp(stdout, f);
- fputs(" * ", stdout);
- pdivmod(n, f, &n, pNull);
- fputp(stdout, n);
- putc('\n', stdout);
- }
-
- pdestroy(f);
- pdestroy(n);
-
- return 0;
-}
diff --git a/src/benchmarks/cfrac/errorp.c b/src/benchmarks/cfrac/errorp.c
deleted file mode 100644
index 5868aa4..0000000
--- a/src/benchmarks/cfrac/errorp.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdio.h>
-#include "precision.h"
-
-/*
- * Fatal error (user substitutable)
- *
- * PNOMEM - out of memory (pcreate)
- * PREFCOUNT - refcount negative (pdestroy)
- * PUNDEFINED - undefined value referenced (all)
- * PDOMAIN - domain error
- * pdivmod: divide by zero
- * psqrt: negative argument
- * POVERFLOW - overflow
- * itop: too big
- */
-precision errorp(errnum, routine, message)
- int errnum;
- char *routine;
- char *message;
-{
- fputs(routine, stderr);
- fputs(": ", stderr);
- fputs(message, stderr);
- fputs("\n", stderr);
- abort(); /* remove this line if you want */
- return pUndef;
-}
diff --git a/src/benchmarks/cfrac/getopt.c b/src/benchmarks/cfrac/getopt.c
deleted file mode 100644
index 788c2cb..0000000
--- a/src/benchmarks/cfrac/getopt.c
+++ /dev/null
@@ -1,757 +0,0 @@
-/* Getopt for GNU.
- NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
- before changing it!
-
- Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94
- Free Software Foundation, Inc.
-
- This program 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 2, or (at your option) any
- later version.
-
- This program 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. */
-
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
- Ditto for AIX 3.2 and <stdlib.h>. */
-#ifndef _NO_PROTO
-#define _NO_PROTO
-#endif
-
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-#if defined (emacs) || defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
-#include <config.h>
-#else
-#include "config.h"
-#endif
-#endif
-
-#ifndef __STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
- contain conflicting prototypes for getopt. */
-#include <stdlib.h>
-#endif /* GNU C library. */
-
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
- but it behaves differently for the user, since it allows the user
- to intersperse the options with the other arguments.
-
- As `getopt' works, it permutes the elements of ARGV so that,
- when it is done, all the options precede everything else. Thus
- all application programs are extended to handle flexible argument order.
-
- Setting the environment variable POSIXLY_CORRECT disables permutation.
- Then the behavior is completely standard.
-
- GNU application programs can use a third alternative mode in which
- they can distinguish the relative order of options and other arguments. */
-
-#include "getopt.h"
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-char *optarg = NULL;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns EOF, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-/* XXX 1003.2 says this must be 1 before any call. */
-int optind = 0;
-
-/* The next char to be scanned in the option-element
- in which the last option character we returned was found.
- This allows us to pick up the scan where we left off.
-
- If this is zero, or a null string, it means resume the scan
- by advancing to the next ARGV-element. */
-
-static char *nextchar;
-
-/* Callers store zero here to inhibit the error message
- for unrecognized options. */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
- This must be initialized on some systems to avoid linking in the
- system's own getopt implementation. */
-
-int optopt = '?';
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
- If the caller did not specify anything,
- the default is REQUIRE_ORDER if the environment variable
- POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
- REQUIRE_ORDER means don't recognize them as options;
- stop option processing when the first non-option is seen.
- This is what Unix does.
- This mode of operation is selected by either setting the environment
- variable POSIXLY_CORRECT, or using `+' as the first character
- of the list of option characters.
-
- PERMUTE is the default. We permute the contents of ARGV as we scan,
- so that eventually all the non-options are at the end. This allows options
- to be given in any order, even with programs that were not written to
- expect this.
-
- RETURN_IN_ORDER is an option available to programs that were written
- to expect options and other ARGV-elements in any order and that care about
- the ordering of the two. We describe each non-option ARGV-element
- as if it were the argument of an option with character code 1.
- Using `-' as the first character of the list of option characters
- selects this mode of operation.
-
- The special argument `--' forces an end of option-scanning regardless
- of the value of `ordering'. In the case of RETURN_IN_ORDER, only
- `--' can cause `getopt' to return EOF with `optind' != ARGC. */
-
-static enum
-{
- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-} ordering;
-
-/* Value of POSIXLY_CORRECT environment variable. */
-static char *posixly_correct;
-
-#ifdef __GNU_LIBRARY__
-/* We want to avoid inclusion of string.h with non-GNU libraries
- because there are many ways it can cause trouble.
- On some systems, it contains special magic macros that don't work
- in GCC. */
-#include <string.h>
-#define my_index strchr
-#else
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-char *getenv ();
-
-static char *
-my_index (str, chr)
- const char *str;
- int chr;
-{
- while (*str)
- {
- if (*str == chr)
- return (char *) str;
- str++;
- }
- return 0;
-}
-
-/* If using GCC, we can safely declare strlen this way.
- If not using GCC, it is ok not to declare it. */
-#ifdef __GNUC__
-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
- That was relevant to code that was here before. */
-#ifndef __STDC__
-/* gcc with -traditional declares the built-in strlen to return int,
- and has done so at least since version 2.4.5. -- rms. */
-extern int strlen (const char *);
-#endif /* not __STDC__ */
-#endif /* __GNUC__ */
-
-#endif /* not __GNU_LIBRARY__ */
-
-/* Handle permutation of arguments. */
-
-/* Describe the part of ARGV that contains non-options that have
- been skipped. `first_nonopt' is the index in ARGV of the first of them;
- `last_nonopt' is the index after the last of them. */
-
-static int first_nonopt;
-static int last_nonopt;
-
-/* Exchange two adjacent subsequences of ARGV.
- One subsequence is elements [first_nonopt,last_nonopt)
- which contains all the non-options that have been skipped so far.
- The other is elements [last_nonopt,optind), which contains all
- the options processed since those non-options were skipped.
-
- `first_nonopt' and `last_nonopt' are relocated so that they describe
- the new indices of the non-options in ARGV after they are moved. */
-
-static void
-exchange (argv)
- char **argv;
-{
- int bottom = first_nonopt;
- int middle = last_nonopt;
- int top = optind;
- char *tem;
-
- /* Exchange the shorter segment with the far end of the longer segment.
- That puts the shorter segment into the right place.
- It leaves the longer segment in the right place overall,
- but it consists of two parts that need to be swapped next. */
-
- while (top > middle && middle > bottom)
- {
- if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
-
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
- else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
-
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
- }
-
- /* Update records for the slots the non-options now occupy. */
-
- first_nonopt += (optind - last_nonopt);
- last_nonopt = optind;
-}
-
-/* Initialize the internal data when the first call is made. */
-
-static const char *
-_getopt_initialize (optstring)
- const char *optstring;
-{
- /* Start processing options with ARGV-element 1 (since ARGV-element 0
- is the program name); the sequence of previously skipped
- non-option ARGV-elements is empty. */
-
- first_nonopt = last_nonopt = optind = 1;
-
- nextchar = NULL;
-
- posixly_correct = getenv ("POSIXLY_CORRECT");
-
- /* Determine how to handle the ordering of options and nonoptions. */
-
- if (optstring[0] == '-')
- {
- ordering = RETURN_IN_ORDER;
- ++optstring;
- }
- else if (optstring[0] == '+')
- {
- ordering = REQUIRE_ORDER;
- ++optstring;
- }
- else if (posixly_correct != NULL)
- ordering = REQUIRE_ORDER;
- else
- ordering = PERMUTE;
-
- return optstring;
-}
-
-/* Scan elements of ARGV (whose length is ARGC) for option characters
- given in OPTSTRING.
-
- If an element of ARGV starts with '-', and is not exactly "-" or "--",
- then it is an option element. The characters of this element
- (aside from the initial '-') are option characters. If `getopt'
- is called repeatedly, it returns successively each of the option characters
- from each of the option elements.
-
- If `getopt' finds another option character, it returns that character,
- updating `optind' and `nextchar' so that the next call to `getopt' can
- resume the scan with the following option character or ARGV-element.
-
- If there are no more option characters, `getopt' returns `EOF'.
- Then `optind' is the index in ARGV of the first ARGV-element
- that is not an option. (The ARGV-elements have been permuted
- so that those that are not options now come last.)
-
- OPTSTRING is a string containing the legitimate option characters.
- If an option character is seen that is not listed in OPTSTRING,
- return '?' after printing an error message. If you set `opterr' to
- zero, the error message is suppressed but we still return '?'.
-
- If a char in OPTSTRING is followed by a colon, that means it wants an arg,
- so the following text in the same ARGV-element, or the text of the following
- ARGV-element, is returned in `optarg'. Two colons mean an option that
- wants an optional arg; if there is text in the current ARGV-element,
- it is returned in `optarg', otherwise `optarg' is set to zero.
-
- If OPTSTRING starts with `-' or `+', it requests different methods of
- handling the non-option ARGV-elements.
- See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
- Long-named options begin with `--' instead of `-'.
- Their names may be abbreviated as long as the abbreviation is unique
- or is an exact match for some defined option. If they have an
- argument, it follows the option name in the same ARGV-element, separated
- from the option name by a `=', or else the in next ARGV-element.
- When `getopt' finds a long-named option, it returns 0 if that option's
- `flag' field is nonzero, the value of the option's `val' field
- if the `flag' field is zero.
-
- The elements of ARGV aren't really const, because we permute them.
- But we pretend they're const in the prototype to be compatible
- with other systems.
-
- LONGOPTS is a vector of `struct option' terminated by an
- element containing a name which is zero.
-
- LONGIND returns the index in LONGOPT of the long-named option found.
- It is only valid when a long-named option has been found by the most
- recent call.
-
- If LONG_ONLY is nonzero, '-' as well as '--' can introduce
- long-named options. */
-
-int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct option *longopts;
- int *longind;
- int long_only;
-{
- optarg = NULL;
-
- if (optind == 0)
- optstring = _getopt_initialize (optstring);
-
- if (nextchar == NULL || *nextchar == '\0')
- {
- /* Advance to the next ARGV-element. */
-
- if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
-
- /* Skip any additional non-options
- and extend the range of non-options previously skipped. */
-
- while (optind < argc
- && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
- optind++;
- last_nonopt = optind;
- }
-
- /* The special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
-
- if (optind != argc && !strcmp (argv[optind], "--"))
- {
- optind++;
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
-
- optind = argc;
- }
-
- /* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
-
- if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return EOF;
- }
-
- /* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
-
- if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
- {
- if (ordering == REQUIRE_ORDER)
- return EOF;
- optarg = argv[optind++];
- return 1;
- }
-
- /* We have found another option-ARGV-element.
- Skip the initial punctuation. */
-
- nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
- }
-
- /* Decode the current option-ARGV-element. */
-
- /* Check whether the ARGV-element is a long option.
-
- If long_only and the ARGV-element has the form "-f", where f is
- a valid short option, don't consider it an abbreviated form of
- a long option that starts with f. Otherwise there would be no
- way to give the -f short option.
-
- On the other hand, if there's a long option "fubar" and
- the ARGV-element is "-fu", do consider that an abbreviation of
- the long option, just like "--fu", and not "-f" with arg "u".
-
- This distinction seems to be the most useful approach. */
-
- if (longopts != NULL
- && (argv[optind][1] == '-'
- || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound;
- int option_index;
-
- for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if (nameend - nextchar == (int) strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
-
- if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, "%s: option `%s' is ambiguous\n",
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return '?';
- }
-
- if (pfound != NULL)
- {
- option_index = indfound;
- optind++;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- {
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- "%s: option `--%s' doesn't allow an argument\n",
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- "%s: option `%c%s' doesn't allow an argument\n",
- argv[0], argv[optind - 1][0], pfound->name);
- }
- nextchar += strlen (nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr, "%s: option `%s' requires an argument\n",
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
-
- /* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
- if (!long_only || argv[optind][1] == '-'
- || my_index (optstring, *nextchar) == NULL)
- {
- if (opterr)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, "%s: unrecognized option `--%s'\n",
- argv[0], nextchar);
- else
- /* +option or -option */
- fprintf (stderr, "%s: unrecognized option `%c%s'\n",
- argv[0], argv[optind][0], nextchar);
- }
- nextchar = (char *) "";
- optind++;
- return '?';
- }
- }
-
- /* Look at and handle the next short option-character. */
-
- {
- char c = *nextchar++;
- char *temp = my_index (optstring, c);
-
- /* Increment `optind' when we start to process its last character. */
- if (*nextchar == '\0')
- ++optind;
-
- if (temp == NULL || c == ':')
- {
- if (opterr)
- {
- if (posixly_correct)
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
- else
- fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c);
- }
- optopt = c;
- return '?';
- }
- if (temp[1] == ':')
- {
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = NULL;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: option requires an argument -- %c\n",
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
- }
- return c;
- }
-}
-
-int
-getopt (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
-{
- return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
-}
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
-
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
- the above definition of `getopt'. */
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
-
- c = getopt (argc, argv, "abc:d:0123456789");
- if (c == EOF)
- break;
-
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/src/benchmarks/cfrac/getopt.h b/src/benchmarks/cfrac/getopt.h
deleted file mode 100644
index 7fc2cca..0000000
--- a/src/benchmarks/cfrac/getopt.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Declarations for getopt.
- Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
-
- This program 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 2, or (at your option) any
- later version.
-
- This program 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. */
-
-#ifndef _GETOPT_H
-#define _GETOPT_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-extern char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns EOF, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-extern int optind;
-
-/* Callers store zero here to inhibit the error message `getopt' prints
- for unrecognized options. */
-
-extern int opterr;
-
-/* Set to an option character which was unrecognized. */
-
-extern int optopt;
-
-/* Describe the long-named options requested by the application.
- The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
- of `struct option' terminated by an element containing a name which is
- zero.
-
- The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
-
- If the field `flag' is not NULL, it points to a variable that is set
- to the value given in the field `val' when the option is found, but
- left unchanged if the option is not found.
-
- To have a long-named option do something other than set an `int' to
- a compiled-in constant, such as set a value from `optarg', set the
- option's `flag' field to zero and its `val' field to a nonzero
- value (the equivalent single-letter option character, if there is
- one). For long options that have a zero `flag' field, `getopt'
- returns the contents of the `val' field. */
-
-struct option
-{
-#if __STDC__
- const char *name;
-#else
- char *name;
-#endif
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'. */
-
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
-
-#if __STDC__
-/* Many other libraries have conflicting prototypes for getopt, with
- differences in the consts, in stdlib.h. We used to try to prototype
- it if __GNU_LIBRARY__ but that wasn't problem free either (I'm not sure
- exactly why), and there is no particular need to prototype it.
- We really shouldn't be trampling on the system's namespace at all by
- declaring getopt() but that is a bigger issue. */
-extern int getopt ();
-
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind);
-
-/* Internal only. Users should not call this directly. */
-extern int _getopt_internal (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
-#else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-#endif /* not __STDC__ */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GETOPT_H */
diff --git a/src/benchmarks/cfrac/itop.c b/src/benchmarks/cfrac/itop.c
deleted file mode 100644
index 87d309a..0000000
--- a/src/benchmarks/cfrac/itop.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "pdefs.h"
-#include "pcvt.h"
-#include "precision.h"
-
-/*
- * Integer to Precision
- */
-precision itop(i)
- register int i;
-{
- register digitPtr uPtr;
- register precision u = palloc(INTSIZE);
-
- if (u == pUndef) return u;
-
- if (u->sign = (i < 0)) i = -i;
- uPtr = u->value;
- do {
- *uPtr++ = modBase(i);
- i = divBase(i);
- } while (i != 0);
-
- u->size = (uPtr - u->value); /* normalize */
- return presult(u);
-}
diff --git a/src/benchmarks/cfrac/ltop.c b/src/benchmarks/cfrac/ltop.c
deleted file mode 100644
index 33eaea5..0000000
--- a/src/benchmarks/cfrac/ltop.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "pdefs.h"
-#include "pcvt.h"
-#include "precision.h"
-
-/*
- * Long to Precision
- */
-precision ltop(l)
- register long l;
-{
- register digitPtr uPtr;
- register precision u = palloc(LONGSIZE);
-
- if (u == pUndef) return u;
-
- if (u->sign = (l < 0L)) l = -l;
- uPtr = u->value;
- do {
- *uPtr++ = modBase(l);
- l = divBase(l);
- } while (l != 0);
-
- u->size = (uPtr - u->value); /* normalize */
- return presult(u);
-}
diff --git a/src/benchmarks/cfrac/pabs.c b/src/benchmarks/cfrac/pabs.c
deleted file mode 100644
index 674cf1b..0000000
--- a/src/benchmarks/cfrac/pabs.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "pdefs.h" /* private include file */
-#include "precision.h" /* public include file for forward refs */
-#include <string.h>
-
-/*
- * absolute value
- */
-precision pabs(u)
- register precision u;
-{
- register precision w;
-
- (void) pparm(u);
- w = palloc(u->size);
- if (w == pUndef) return w;
-
- w->sign = false;
- (void) memcpy(w->value, u->value, u->size * sizeof(digit));
-
- pdestroy(u);
- return presult(w);
-}
diff --git a/src/benchmarks/cfrac/padd.c b/src/benchmarks/cfrac/padd.c
deleted file mode 100644
index 62b93d5..0000000
--- a/src/benchmarks/cfrac/padd.c
+++ /dev/null
@@ -1,94 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-#include <string.h>
-
-#ifdef ASM_16BIT
-#include "asm16bit.h"
-#endif
-
-/*
- * Add
- *
- * This will work correctly if -0 is passed as input
- */
-precision padd(u, v)
- register precision v;
-#ifndef ASM_16BIT
- precision u;
-{
- register digitPtr wPtr, uPtr, vPtr;
-#else
- register precision u;
-{
- register digitPtr wPtr;
- digitPtr uPtr;
-#endif
- precision w; /* function result */
- register accumulator temp; /* 0 <= temp < 2*base */
- register digit carry; /* 0 <= carry <= 1 */
-#ifdef ASM_16BIT
- register int size;
-#endif
-
- (void) pparm(u);
- (void) pparm(v);
- if (u->sign != v->sign) { /* Are we are actually subtracting? */
- w = pUndef;
- if (v->sign) {
- v->sign = !v->sign; /* can't generate -0 */
- pset(&w, psub(u, v));
- v->sign = !v->sign;
- } else {
- u->sign = !u->sign; /* can't generate -0 */
- pset(&w, psub(v, u));
- u->sign = !u->sign;
- }
- } else {
- if (u->size < v->size) { /* u is always biggest number */
- w = u; u = v; v = w;
- }
-
- w = palloc(u->size+1); /* there is at most one added digit */
- if (w == pUndef) return w; /* arguments not destroyed */
-
- w->sign = u->sign;
-
- uPtr = u->value;
- wPtr = w->value;
-#ifndef ASM_16BIT
- vPtr = v->value;
- carry = 0;
- do { /* Add digits in both args */
- temp = *uPtr++ + *vPtr++; /* 0 <= temp < 2*base-1 */
- temp += carry; /* 0 <= temp < 2*base */
- carry = divBase(temp); /* 0 <= carry <= 1 */
- *wPtr++ = modBase(temp); /* mod has positive args */
- } while (vPtr < v->value + v->size);
-
- while (uPtr < u->value + u->size) { /* propogate carry */
- temp = *uPtr++ + carry;
- carry = divBase(temp);
- *wPtr++ = modBase(temp);
- }
- *wPtr = carry;
-#else
- size = v->size;
- temp = u->size - size;
- carry = memaddw(wPtr, uPtr, v->value, size);
- if (temp > 0) {
- memcpy(wPtr + size, uPtr + size, temp * sizeof(digit));
- if (carry) {
- carry = memincw(wPtr + size, temp);
- }
- }
- wPtr[u->size] = carry; /* yes, I do mean u->size */
-#endif
- if (carry == 0) {
- --(w->size);
- }
- }
-
- pdestroy(u);
- pdestroy(v);
- return presult(w);
-}
diff --git a/src/benchmarks/cfrac/pcfrac.c b/src/benchmarks/cfrac/pcfrac.c
deleted file mode 100644
index 2a0d032..0000000
--- a/src/benchmarks/cfrac/pcfrac.c
+++ /dev/null
@@ -1,731 +0,0 @@
-/*
- * pcfrac: Implementation of the continued fraction factoring algoritm
- *
- * Every two digits additional appears to double the factoring time
- *
- * Written by Dave Barrett (barrett%asgard@boulder.Colorado.EDU)
- */
-#include <string.h>
-#include <stdio.h>
-#include <math.h>
-
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#include "precision.h"
-#include "pfactor.h"
-
-extern int verbose;
-
-unsigned cfracNabort = 0;
-unsigned cfracTsolns = 0;
-unsigned cfracPsolns = 0;
-unsigned cfracT2solns = 0;
-unsigned cfracFsolns = 0;
-
-extern unsigned short primes[];
-extern unsigned primesize;
-
-typedef unsigned *uptr;
-typedef uptr uvec;
-typedef unsigned char *solnvec;
-typedef unsigned char *BitVector;
-
-typedef struct SolnStruc {
- struct SolnStruc *next;
- precision x; /* lhs of solution */
- precision t; /* last large prime remaining after factoring */
- precision r; /* accumulated root of pm for powers >= 2 */
- BitVector e; /* bit vector of factorbase powers mod 2 */
-} Soln;
-
-typedef Soln *SolnPtr;
-
-#define BPI(x) ((sizeof x[0]) << 3)
-
-void setBit(bv, bno, value)
- register BitVector bv;
- register unsigned bno, value;
-{
- bv += bno / BPI(bv);
- bno %= BPI(bv);
- *bv |= ((value != 0) << bno);
-}
-
-unsigned getBit(bv, bno)
- register BitVector bv;
- register unsigned bno;
-{
- register unsigned res;
-
- bv += bno / BPI(bv);
- bno %= BPI(bv);
- res = (*bv >> bno) & 1;
-
- return res;
-}
-
-BitVector newBitVector(value, size)
- register solnvec value;
- unsigned size;
-{
- register BitVector res;
- register solnvec vp = value + size;
- unsigned msize = ((size + BPI(res)-1) / BPI(res)) * sizeof res[0];
-
-#ifdef BWGC
- res = (BitVector) gc_malloc(msize);
-#else
- res = (BitVector) malloc(msize);
-#endif
- if (res == (BitVector) 0) return res;
-
- memset(res, '\0', msize);
- do {
- if (*--vp) {
- setBit(res, vp - value, (unsigned) *vp);
- }
- } while (vp != value);
- return res;
-}
-
-void printSoln(stream, prefix, suffix, pm, m, p, t, e)
- FILE *stream;
- char *prefix, *suffix;
- register unsigned *pm, m;
- precision p, t;
- register solnvec e;
-{
- register unsigned i, j = 0;
-
- for (i = 1; i <= m; i++) j += (e[i] != 0);
-
- fputs(prefix, stream);
- fputp(stream, pparm(p)); fputs(" = ", stream);
- if (*e & 1) putc('-', stream); else putc('+', stream);
- fputp(stream, pparm(t));
-
- if (j >= 1) fputs(" *", stream);
- do {
- e++;
- switch (*e) {
- case 0: break;
- case 1: fprintf(stream, " %u", *pm); break;
- default:
- fprintf(stream, " %u^%u", *pm, (unsigned) *e);
- }
- pm++;
- } while (--m);
-
- fputs(suffix, stream);
- fflush(stream);
- pdestroy(p); pdestroy(t);
-}
-
-/*
- * Combine two solutions
- */
-void combineSoln(x, t, e, pm, m, n, bp)
- precision *x, *t, n;
- uvec pm;
- register solnvec e;
- unsigned m;
- SolnPtr bp;
-{
- register unsigned j;
-
- (void) pparm(n);
- if (bp != (SolnPtr) 0) {
- pset(x, pmod(pmul(bp->x, *x), n));
- pset(t, pmod(pmul(bp->t, *t), n));
- pset(t, pmod(pmul(bp->r, *t), n));
- e[0] += getBit(bp->e, 0);
- }
- e[0] &= 1;
- for (j = 1; j <= m; j++) {
- if (bp != (SolnPtr) 0) e[j] += getBit(bp->e, j);
- if (e[j] > 2) {
- pset(t, pmod(pmul(*t,
- ppowmod(utop(pm[j-1]), utop((unsigned) e[j]>>1), n)), n));
- e[j] &= 1;
- } else if (e[j] == 2) {
- pset(t, pmod(pmul(*t, utop(pm[j-1])), n));
- e[j] = 0;
- }
- }
- pdestroy(n);
-}
-
-/*
- * Create a normalized solution structure from the given inputs
- */
-SolnPtr newSoln(n, pm, m, next, x, t, e)
- precision n;
- unsigned m;
- uvec pm;
- SolnPtr next;
- precision x, t;
- solnvec e;
-{
-#ifdef BWGC
- SolnPtr bp = (SolnPtr) gc_malloc(sizeof (Soln));
-#else
- SolnPtr bp = (SolnPtr) malloc(sizeof (Soln));
-#endif
-
- if (bp != (SolnPtr) 0) {
- bp->next = next;
- bp->x = pnew(x);
- bp->t = pnew(t);
- bp->r = pnew(pone);
- /*
- * normalize e, put the result in bp->r and e
- */
- combineSoln(&bp->x, &bp->r, e, pm, m, pparm(n), (SolnPtr) 0);
- bp->e = newBitVector(e, m+1); /* BitVector */
- }
-
- pdestroy(n);
- return bp;
-}
-
-void freeSoln(p)
- register SolnPtr p;
-{
- if (p != (SolnPtr) 0) {
- pdestroy(p->x);
- pdestroy(p->t);
- pdestroy(p->r);
-#ifndef IGNOREFREE
- free(p->e); /* BitVector */
- free(p);
-#endif
- }
-}
-
-void freeSolns(p)
- register SolnPtr p;
-{
- register SolnPtr l;
-
- while (p != (SolnPtr) 0) {
- l = p;
- p = p->next;
- freeSoln(l);
- }
-}
-
-SolnPtr findSoln(sp, t)
- register SolnPtr sp;
- precision t;
-{
- (void) pparm(t);
- while (sp != (SolnPtr) 0) {
- if peq(sp->t, t) break;
- sp = sp->next;
- }
- pdestroy(t);
- return sp;
-}
-
-static unsigned pcfrac_k = 1;
-static unsigned pcfrac_m = 0;
-static unsigned pcfrac_aborts = 3;
-
-/*
- * Structure for early-abort. Last entry must be <(unsigned *) 0, uUndef>
- */
-typedef struct {
- unsigned *pm; /* bound check occurs before using this pm entry */
- precision bound; /* max allowable residual to prevent abort */
-} EasEntry;
-
-typedef EasEntry *EasPtr;
-
-void freeEas(eas)
- EasPtr eas;
-{
- register EasPtr ep = eas;
-
- if (ep != (EasPtr) 0) {
- while (ep->pm != 0) {
- pdestroy(ep->bound);
- ep++;
- }
-#ifndef IGNOREFREE
- free(eas);
-#endif
- }
-}
-
-/*
- * Return Pomerance's L^alpha (L = exp(sqrt(log(n)*log(log(n)))))
- */
-double pomeranceLpow(n, y)
- double n;
- double y;
-{
- double lnN = log(n);
- double res = exp(y * sqrt(lnN * log(lnN)));
- return res;
-}
-
-/*
- * Pomerance's value 'a' from page 122 "of Computational methods in Number
- * Theory", part 1, 1982.
- */
-double cfracA(n, aborts)
- double n;
- unsigned aborts;
-{
- return 1.0 / sqrt(6.0 + 2.0 / ((double) aborts + 1.0));
-}
-
-/*
- * Returns 1 if a is a quadratic residue of odd prime p,
- * p-1 if non-quadratic residue, 0 otherwise (gcd(a,p)<>1)
- */
-#define plegendre(a,p) ppowmod(a, phalf(psub(p, pone)), p)
-
-/*
- * Create a table of small primes of quadratic residues of n
- *
- * Input:
- * n - the number to be factored
- * k - the multiple of n to be factored
- * *m - the number of primes to generate (0 to select best)
- * aborts - the number of early aborts
- *
- * Assumes that plegendre # 0, for if it is, that pm is a factor of n.
- * This algorithm already assumes you've used trial division to eliminate
- * all of these!
- *
- * Returns: the list of primes actually generated (or (unsigned *) 0 if nomem)
- * *m changed to reflect the number of elements in the list
- */
-uvec pfactorbase(n, k, m, aborts)
- precision n;
- unsigned k;
- unsigned *m, aborts;
-{
- double dn, a;
- register unsigned short *primePtr = primes;
- register unsigned count = *m;
- unsigned maxpm = primes[primesize-1];
- unsigned *res = (uvec) 0, *pm;
- precision nk = pnew(pmul(pparm(n), utop(k)));
-
- if (*m == 0) { /* compute a suitable m */
- dn = ptod(nk);
- a = cfracA(dn, aborts);
- maxpm = (unsigned) (pomeranceLpow(dn, a) + 0.5);
- do {
- if ((unsigned) *primePtr++ >= maxpm) break;
- } while ((unsigned) *primePtr != 1);
- count = primePtr - primes;
- primePtr = primes;
- }
- /*
- * This m tends to be too small for small n, and becomes closer to
- * optimal as n goes to infinity. For 30 digits, best m is ~1.5 this m.
- * For 38 digits, best m appears to be ~1.15 this m. It's appears to be
- * better to guess too big than too small.
- */
-#ifdef BWGC
- res = (uvec) gc_malloc(count * sizeof (unsigned));
-#else
- res = (uvec) malloc(count * sizeof (unsigned));
-#endif
- if (res == (uvec) 0) goto doneMk;
-
- pm = res;
- *pm++ = (unsigned) *primePtr++; /* two is first element */
- count = 1;
- if (count != *m) do {
- if (picmp(plegendre(nk, utop((unsigned) *primePtr)), 1) <= 0) { /* 0,1 */
- *pm++ = *primePtr;
- count++;
- if (count == *m) break;
- if ((unsigned) *primePtr >= maxpm) break;
- }
- ++primePtr;
- } while (*primePtr != 1);
- *m = count;
-
-doneMk:
- pdestroy(nk);
- pdestroy(n);
- return res;
-}
-
-/*
- * Compute Pomerance's early-abort-stragegy
- */
-EasPtr getEas(n, k, pm, m, aborts)
- precision n;
- unsigned k, *pm, m, aborts;
-{
- double x = 1.0 / ((double) aborts + 1.0);
- double a = 1.0 / sqrt(6.0 + 2.0 * x);
- double ax = a * x, csum = 1.0, tia = 0.0;
- double dn, dpval, dbound, ci;
- unsigned i, j, pval;
-
- precision bound = pUndef;
- EasPtr eas;
-
- if (aborts == 0) return (EasPtr) 0;
-
-#ifdef BWGC
- eas = (EasPtr) gc_malloc((aborts+1) * sizeof (EasEntry));
-#else
- eas = (EasPtr) malloc((aborts+1) * sizeof (EasEntry));
-#endif
- if (eas == (EasPtr) 0) return eas;
-
- dn = ptod(pmul(utop(k), pparm(n))); /* should this be n ? */
- for (i = 1; i <= aborts; i++) {
- eas[i-1].pm = (unsigned *) 0;
- eas[i-1].bound = pUndef;
- tia += ax;
- ci = 4.0 * tia * tia / (double) i;
- csum -= ci;
- dpval = pomeranceLpow(dn, tia);
- dbound = pow(dn, 0.5 * csum);
-
- pval = (unsigned) (dpval + 0.5);
- pset(&bound, dtop(dbound));
- for (j = 0; j < m; j++) {
- if (pm[j] >= pval) goto foundpm;
- }
- break;
-foundpm:
- if (verbose > 1) {
- printf(" Abort %u on p = %u (>=%u) and q > ", i, pm[j], pval);
- fputp(stdout, bound); putc('\n', stdout);
- fflush(stdout);
- }
- eas[i-1].pm = &pm[j];
- pset(&eas[i-1].bound, bound);
- }
- eas[i-1].pm = (unsigned *) 0;
- eas[i-1].bound = pUndef;
-
- pdestroy(bound);
- pdestroy(n);
-
- return eas;
-}
-
-/*
- * Factor the argument Qn using the primes in pm. Result stored in exponent
- * vector e, and residual factor, f. If non-null, eas points to a list of
- * early-abort boundaries.
- *
- * e is set to the number of times each prime in pm divides v.
- *
- * Returns:
- * -2 - if factoring aborted because of early abort
- * -1 - factoring failed
- * 0 - if result is a "partial" factoring
- * 1 - normal return (a "full" factoring)
- */
-int pfactorQ(f, t, pm, e, m, eas)
- precision *f;
- precision t;
- register unsigned *pm;
- register solnvec e;
- register unsigned m;
- EasEntry *eas;
-{
- precision maxp = pUndef;
- unsigned maxpm = pm[m-1], res = 0;
- register unsigned *pp = (unsigned *) 0;
-
- (void) pparm(t);
-
- if (eas != (EasEntry *) 0) {
- pp = eas->pm;
- pset(&maxp, eas->bound);
- }
-
- memset((char *) e, '\0', m * sizeof e[0]); /* looks slow here, but isn't */
-
- while (peven(t)) { /* assume 2 1st in pm; save time */
- pset(&t, phalf(t));
- (*e)++;
- }
- --m;
-
- do {
- e++; pm++;
- if (pm == pp) { /* check for early abort */
- if (pgt(t, maxp)) {
- res = -2;
- goto gotSoln;
- }
- eas++;
- pp = eas->pm;
- pset(&maxp, eas->bound);
- }
- while (pimod(t, (int) *pm) == 0) {
- pset(&t, pidiv(t, (int) *pm));
- (*e)++;
- }
- } while (--m != 0);
- res = -1;
- if (picmp(t, 1) == 0) {
- res = 1;
- } else if (picmp(pidiv(t, (int) *pm), maxpm) <= 0) {
-#if 0 /* it'll never happen; Honest! If so, pm is incorrect. */
- if (picmp(t, maxpm) <= 0) {
- fprintf(stderr, "BUG: partial with t < maxpm! t = ");
- fputp(stderr, t); putc('\n', stderr);
- }
-#endif
- res = 0;
- }
-gotSoln:
- pset(f, t);
- pdestroy(t); pdestroy(maxp);
- return res;
-}
-
-/*
- * Attempt to factor n using continued fractions (n must NOT be prime)
- *
- * n - The number to attempt to factor
- * maxCount - if non-null, points to the maximum number of iterations to try.
- *
- * This algorithm may fail if it get's into a cycle or maxCount expires
- * If failed, n is returned.
- *
- * This algorithm will loop indefinitiely in n is prime.
- *
- * This an implementation of Morrison and Brillhart's algorithm, with
- * Pomerance's early abort strategy, and Knuth's method to find best k.
- */
-precision pcfrac(n, maxCount)
- precision n;
- unsigned *maxCount;
-{
- unsigned k = pcfrac_k;
- unsigned m = pcfrac_m;
- unsigned aborts = pcfrac_aborts;
- SolnPtr oddt = (SolnPtr) 0, sp, bp, *b;
- EasPtr eas = (EasPtr) 0;
- uvec pm = (uvec) 0;
- solnvec e = (solnvec) 0;
- unsigned bsize, s = 0, count = 0;
- register unsigned h, j;
- int i;
-
- precision t = pUndef,
- r = pUndef, twog = pUndef, u = pUndef, lastU = pUndef,
- Qn = pUndef, lastQn = pUndef, An = pUndef, lastAn = pUndef,
- x = pUndef, y = pUndef, qn = pUndef, rn = pUndef;
-
- precision res = pnew(pparm(n)); /* default res is argument */
-
- pm = pfactorbase(n, k, &m, aborts); /* m may have been reduced */
-
- bsize = (m+2) * sizeof (SolnPtr);
-#ifdef BWGC
- b = (SolnPtr *) gc_malloc(bsize);
-#else
- b = (SolnPtr *) malloc(bsize);
-#endif
- if (b == (SolnPtr *) 0) goto nomem;
-
-#ifdef BWGC
- e = (solnvec) gc_malloc((m+1) * sizeof e[0]);
-#else
- e = (solnvec) malloc((m+1) * sizeof e[0]);
-#endif
- if (e == (solnvec) 0) {
-nomem:
- errorp(PNOMEM, "pcfrac", "out of memory");
- goto bail;
- }
-
- memset(b, '\0', bsize); /* F1: Initialize */
- if (maxCount != (unsigned *) 0) count = *maxCount;
- cfracTsolns = cfracPsolns = cfracT2solns = cfracFsolns = cfracNabort = 0;
-
- eas = getEas(n, k, pm, m, aborts); /* early abort strategy */
-
- if (verbose > 1) {
- fprintf(stdout, "factorBase[%u]: ", m);
- for (j = 0; j < m; j++) {
- fprintf(stdout, "%u ", pm[j]);
- }
- putc('\n', stdout);
- fflush(stdout);
- }
-
- pset(&t, pmul(utop(k), n)); /* E1: Initialize */
- pset(&r, psqrt(t)); /* constant: sqrt(k*n) */
- pset(&twog, padd(r, r)); /* constant: 2*sqrt(k*n) */
- pset(&u, twog); /* g + Pn */
- pset(&lastU, twog);
- pset(&Qn, pone);
- pset(&lastQn, psub(t, pmul(r, r)));
- pset(&An, pone);
- pset(&lastAn, r);
- pset(&qn, pzero);
-
- do {
-F2:
- do {
- if (--count == 0) goto bail;
- pset(&t, An);
- pdivmod(padd(pmul(qn, An), lastAn), n, pNull, &An); /* (5) */
- pset(&lastAn, t);
-
- pset(&t, Qn);
- pset(&Qn, padd(pmul(qn, psub(lastU, u)), lastQn)); /* (7) */
- pset(&lastQn, t);
-
- pset(&lastU, u);
-
- pset(&qn, pone); /* eliminate 40% of next divmod */
- pset(&rn, psub(u, Qn));
- if (pge(rn, Qn)) {
- pdivmod(u, Qn, &qn, &rn); /* (4) */
- }
- pset(&u, psub(twog, rn)); /* (6) */
- s = 1-s;
-
- e[0] = s;
- i = pfactorQ(&t, Qn, pm, &e[1], m, eas); /* E3: Factor Qn */
- if (i < -1) cfracNabort++;
- /*
- * We should (but don't, yet) check to see if we can get a
- * factor by a special property of Qn = 1
- */
- if (picmp(Qn, 1) == 0) {
- errorp(PDOMAIN, "pcfrac", "cycle encountered; pick bigger k");
- goto bail; /* we ran into a cycle; give up */
- }
- } while (i < 0); /* while not a solution */
-
- pset(&x, An); /* End of Algorithm E; we now have solution: <x,t,e> */
-
- if (i == 0) { /* if partial */
- if ((sp = findSoln(oddt, t)) == (SolnPtr) 0) {
- cfracTsolns++;
- if (verbose >= 2) putc('.', stderr);
- if (verbose > 3) printSoln(stdout, "Partial: ","\n", pm,m,x,t,e);
- oddt = newSoln(n, pm, m, oddt, x, t, e);
- goto F2; /* wait for same t to occur again */
- }
- if (verbose > 3) printSoln(stdout, "Partial: ", " -->\n", pm,m,x,t,e);
- pset(&t, pone); /* take square root */
- combineSoln(&x, &t, e, pm, m, n, sp);
- cfracT2solns++;
- if (verbose) putc('#', stderr);
- if (verbose > 2) printSoln(stdout, "PartSum: ", "", pm, m, x, t, e);
- } else {
- combineSoln(&x, &t, e, pm, m, n, (SolnPtr) 0); /* normalize */
- cfracPsolns++;
- if (verbose) putc('*', stderr);
- if (verbose > 2) printSoln(stdout, "Full: ", "", pm, m, x, t, e);
- }
-
- /*
- * Crude gaussian elimination. We should be more effecient about the
- * binary vectors here, but this works as it is.
- *
- * At this point, t must be pone, or t occurred twice
- *
- * Loop Invariants: e[0:h] even
- * t^2 is a product of squares of primes
- * b[h]->e[0:h-1] even and b[h]->e[h] odd
- */
- h = m+1;
- do {
- --h;
- if (e[h]) { /* F3: Search for odd */
- bp=b[h];
- if (bp == (SolnPtr) 0) { /* F4: Linear dependence? */
- if (verbose > 3) {
- printSoln(stdout, " -->\nFullSum: ", "", pm, m, x, t, e);
- }
- if (verbose > 2) putc('\n', stdout);
- b[h] = newSoln(n, pm, m, bp, x, t, e);
- goto F2;
- }
- combineSoln(&x, &t, e, pm, m, n, bp);
- }
- } while (h != 0);
- /*
- * F5: Try to Factor: We have a perfect square (has about 50% chance)
- */
- cfracFsolns++;
- pset(&y, t); /* t is already sqrt'd */
-
- switch (verbose) {
- case 0: break;
- case 1: putc('/', stderr); break;
- case 2: putc('\n', stderr); break;
- default: ;
- putc('\n', stderr);
- printSoln(stdout, " -->\nSquare: ", "\n", pm, m, x, t, e);
- fputs("x,y: ", stdout);
- fputp(stdout, x); fputs(" ", stdout);
- fputp(stdout, y); putc('\n', stdout);
- fflush(stdout);
- }
- } while (peq(x, y) || peq(padd(x, y), n)); /* while x = +/- y */
-
- pset(&res, pgcd(padd(x, y), n)); /* factor found at last */
-
- /*
- * Check for degenerate solution. This shouldn't happen. Detects bugs.
- */
- if (peq(res, pone) || peq(res, n)) {
- fputs("Error! Degenerate solution:\n", stdout);
- fputs("x,y: ", stdout);
- fputp(stdout, x); fputs(" ", stdout);
- fputp(stdout, y); putc('\n', stdout);
- fflush(stdout);
- abort();
- }
-
-bail:
- if (maxCount != (unsigned *) 0) *maxCount = count;
-
- if (b != (SolnPtr *) 0) for (j = 0; j <= m; j++) freeSoln(b[j]);
- freeEas(eas);
- freeSolns(oddt);
-#ifndef IGNOREFREE
- free(e);
- free(pm);
-#endif
-
- pdestroy(r); pdestroy(twog); pdestroy(u); pdestroy(lastU);
- pdestroy(Qn); pdestroy(lastQn); pdestroy(An); pdestroy(lastAn);
- pdestroy(x); pdestroy(y); pdestroy(qn); pdestroy(rn);
- pdestroy(t); pdestroy(n);
-
- return presult(res);
-}
-
-/*
- * Initialization for pcfrac factoring method
- *
- * k - An integer multiplier to use for n (k must be < n)
- * you can use findk to get a good value. k should be squarefree
- * m - The number of primes to use in the factor base
- * aborts - the number of early aborts to use
- */
-int pcfracInit(m, k, aborts)
- unsigned m;
- unsigned k;
- unsigned aborts;
-{
- pcfrac_m = m;
- pcfrac_k = k;
- pcfrac_aborts = aborts;
- return 1;
-}
diff --git a/src/benchmarks/cfrac/pcmp.c b/src/benchmarks/cfrac/pcmp.c
deleted file mode 100644
index 2c8e0b8..0000000
--- a/src/benchmarks/cfrac/pcmp.c
+++ /dev/null
@@ -1,68 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-
-/*
- * Compare to zero (normalization not assumed)
- *
- * Returns same as pcmp(u, 0);
- */
-int pcmpz(u)
- register precision u;
-{
- register digitPtr uPtr;
- register int i;
-
- (void) pparm(u);
- i = 0;
- uPtr = u->value;
- do {
- if (*uPtr++ != 0) {
- if (u->sign) i = -1; else i = 1;
- break;
- }
- } while (uPtr < u->value + u->size);
-
- pdestroy(u);
- return i;
-}
-
-/*
- * Compare u to v.
- *
- * Return: < 0 if u < v
- * = 0 if u = v
- * > 0 if u > v
- *
- * This routine is the one that assumes results are normalized!
- * - no leading 0's
- * - no negative 0
- */
-int pcmp(u, v)
- precision u, v;
-{
- register digitPtr uPtr, vPtr;
- register int i; /* should be bigger than posit */
-
- (void) pparm(u);
- (void) pparm(v);
- if (u->sign != v->sign) {
- if (u->sign) i = -1; else i = 1;
- } else {
- i = u->size - v->size;
- if (i == 0) {
- uPtr = u->value + u->size;
- vPtr = v->value + v->size;
- do {
- if (*--uPtr != *--vPtr) break;
- } while (vPtr > v->value);
- if (*uPtr > *vPtr) i = 1;
- else if (*uPtr < *vPtr) i = -1;
- }
-
- if (u->sign) i = -i;
- }
-
- pdestroy(u);
- pdestroy(v);
- return i;
-}
diff --git a/src/benchmarks/cfrac/pconst.c b/src/benchmarks/cfrac/pconst.c
deleted file mode 100644
index 89b63a7..0000000
--- a/src/benchmarks/cfrac/pconst.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "pdefs.h"
-
-static precisionType pzeroConst = {
-#ifndef BWGC
- (short) 1, /* refcount (read/write!) */
-#endif
- (posit) 1, /* size */
- (posit) 1, /* digitcount */
- (boolean) 0, /* sign */
- { (digit) 0 } /* value */
-};
-
-static precisionType poneConst = {
-#ifndef BWGC
- (short) 1, /* refcount (read/write!) */
-#endif
- (posit) 1, /* size */
- (posit) 1, /* digitcount */
- (boolean) 0, /* sign */
- { (digit) 1 } /* value */
-};
-
-static precisionType ptwoConst = {
-#ifndef BWGC
- (short) 1, /* refcount (read/write!) */
-#endif
- (posit) 1, /* size */
- (posit) 1, /* digitcount */
- (boolean) 0, /* sign */
- { (digit) 2 } /* value */
-};
-
-static precisionType p_oneConst = {
-#ifndef BWGC
- (short) 1, /* refcount (read/write!) */
-#endif
- (posit) 1, /* size */
- (posit) 1, /* digitcount */
- (boolean) 1, /* sign */
- { (digit) 1 } /* value */
-};
-
-precision pzero = &pzeroConst; /* zero */
-precision pone = &poneConst; /* one */
-precision ptwo = &ptwoConst; /* two */
-precision p_one = &p_oneConst; /* negative one */
diff --git a/src/benchmarks/cfrac/pcvt.h b/src/benchmarks/cfrac/pcvt.h
deleted file mode 100644
index e2dd724..0000000
--- a/src/benchmarks/cfrac/pcvt.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Machine dependent file used for conversion routines
- * (e.g. atop, ptoa, itop, ptoi, etc)
- */
-
-/*
- * For pXtop: (X = {i,u,l,ul,d})
- */
-#define INTSIZE 2 /* floor(log[Base](2*(MAXINT+1))) */
-#define LONGSIZE 2 /* floor(log[Base](2*(MAXLONG+1))) */
-#define DOUBLESIZE 129 /* double precision size = log[base](HUGE) */
-
-/*
- * For ptoX
- */
-#define MAXINT (int) ((unsigned int) ~0 >> 1)
-#define MAXLONG (long) ((unsigned long) ~0 >> 1)
-#define MAXUNSIGNED (~ (unsigned int) 0)
-#define MAXUNSIGNEDLONG (~ (unsigned long) 0L)
-
-#define MAXACC (~ (accumulator) 0)
-
-/*
- * aBase - Ascii base (ptoa)
- * There are aDigits Ascii digits per precision digit, pDigits.
- * At least one of { aDigits, pDigits } <= (MAXINT / the maximum posit value).
- */
-#define aDigits 525 /* aDigits/pDigits >~= log[aBase](Base) */
-#define pDigits 109 /* 525/109=4.8165>log[10](65536)=4.816479931 */
-#define aBase 10 /* string conversion base */
-#define aDigit 1000000000 /* must be power of aBase < MAXINT */
-#define aDigitLog 9 /* log[aBase] of aDigit */
diff --git a/src/benchmarks/cfrac/pdefs.h b/src/benchmarks/cfrac/pdefs.h
deleted file mode 100644
index 9c43099..0000000
--- a/src/benchmarks/cfrac/pdefs.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * +------------------------------------------------------------------+
- * | Private Math Library Definitions |
- * +------------------------------------------------------------------+
- */
-/*
- * Optional assembly language
- */
-#ifdef ASM
-#include "machineop.h" /* 16-bit integer machine operations */
-#define uModDiv(n, d, qp) umoddiv16(n, d, qp) /* slight help */
-#else
-#define uModDiv(n, d, qp) (*(qp) = (n) / (d), (n) % (d))
-#endif
-#define uMul(u, v) ((u) * (v)) /* fast enough */
-
-/*
- * Optional alternate memory allocator
- */
-
-#ifndef MYALLOC
-
-# if defined(BWGC)
-extern char *gc_malloc_atomic();
-#define allocate(size) (char *) gc_malloc_atomic(size)
-# elif defined(CUSTOM_MALLOC)
-#define allocate(size) CUSTOM_MALLOC(size)
-# else
-/* extern char *malloc(); */
-#define allocate(size) (char *) malloc(size)
-# endif
-
-#ifdef IGNOREFREE
-#define deallocate(p) {};
-# elif defined(CUSTOM_FREE)
-#define deallocate(p) CUSTOM_FREE(p)
-#else
-/*
-extern int free();
-*/
-#define deallocate(p) free(p)
-#endif
-
-#else
-extern char *allocate();
-extern void deallocate();
-#endif
-
-/*
- * These next four types are used only used in this include file
- */
-#include <stdint.h>
-typedef unsigned char u8; /* 8 bits */
-typedef uint16_t u16; /* 16 bits */
-typedef uint32_t u32; /* 32 bits */
-typedef u8 boolean; /* 1 bit */
-
-#define BASE 65536 /* Base * (Base-1) <= MAXINT */
-
-/*
- * Operations on Base (unsigned math)
- */
-#define modBase(u) ((u) & 0xffff) /* remainder on Base */
-#define divBase(u) ((u) >> 16) /* divide by Base */
-#define mulBase(u) ((u) << 16) /* multiply by Base */
-
-/*
- * The type of a variable used to store intermediate results.
- * This should be the most efficient unsigned int on your machine.
- */
-typedef u32 accumulator; /* 0..(Base * Base) - 1 */
-
-/*
- * The type of a single digit
- */
-typedef u16 digit; /* 0..Base-1 */
-
-/*
- * The type of a digit index (the largest number of digits - 1)
- * Determines the maximum representable precision (not usually changed)
- */
-typedef u16 posit; /* 0..size */
-
-typedef unsigned short prefc; /* in precision.h also */
-/*
- * End of area which needs to be modified
- */
-
-#define false 0
-#define true 1
-
-typedef digit digitString[1]; /* dummy array type */
-typedef digit *digitPtr;
-
-/*
- * A normalized integer has the following attributes:
- * -0 cannot occur
- * all digits >= size assumed to be 0. (no leading zero's)
- * size > 0
- */
-typedef struct {
-#ifndef BWGC
- prefc refcount; /* reference count (must be 1st [for pref]) */
-#endif
- posit alloc; /* allocated size */
- posit size; /* number of digits */
- boolean sign; /* sign: TRUE negative */
- digitString value;
-} precisionType;
-
-typedef precisionType *precision;
-
-/*
- * Overlay for cache of precisions
- */
-typedef struct {
- precision next; /* next item in list */
- short count; /* number of items in this sublist */
-} cacheType;
-
-typedef cacheType *cachePtr;
-/*
- * Maximum total memory consumed by cache =
- * LIMIT * (1 + SIZE * (PrecisionSize + sizeof(digit) * (SIZE-1) / 2))
- */
-#ifndef CACHESIZE
-#define CACHESIZE 32 /* size of allocation cache */
-#endif
-#define CACHELIMIT 128 /* Determines max mem used by cache */
-
-#define PrecisionSize (sizeof(precisionType) - sizeof(digitString))
-
-/*
- * Function definitions are all in the global include file "mathdefs.h".
- */
-extern precision palloc(); /* semi-private */
-extern int pfree(); /* semi-private */
-extern void pnorm(); /* semi-private */
diff --git a/src/benchmarks/cfrac/pdivmod.c b/src/benchmarks/cfrac/pdivmod.c
deleted file mode 100644
index ce4a24b..0000000
--- a/src/benchmarks/cfrac/pdivmod.c
+++ /dev/null
@@ -1,315 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-#ifdef ASM_16BIT
-#include "asm16bit.h"
-#endif
-
-/*
- * Divide u (dividend) by v (divisor); If non-null, qp and rp are set to
- * quotient and remainder. The result returned will be *qp, unless qp is
- * NULL, then *rp will be returned if non-null, otherwise pUndef is returned.
- *
- * Produce:
- *
- * q (quotient) = u div v (v != 0)
- * truncation is toward zero
- *
- * r (remainder) = u mod v
- * = u - u div v * v (v != 0)
- * = u (v == 0)
- * ( e.g. u == q*v + r )
- * remainder has same sign and dividend
- *
- * Note: this has opposite convention than the C standard div fuction,
- * but the same convention of the typical C "/" operator
- * It is also inconvienient for the mod function.
- */
-/*
- * This algorithm is taken almost verbatum from Knuth Vol 2.
- * Please note the following trivial(?) array index
- * transformations (since MSD to LSD order is reversed):
- *
- * q[0..m] to Q[0..m] thus q[i] == Q[m-i]
- * r[1..n] R[0..n-1] r[i] == R[n+1-i]
- * u[0..m+n] w[0..m+n] u[i] == w[m+n-i]
- * v[1..n] x[0..n-1] v[i] == x[n-i]
- *
- * let N == n - 1 so that n == N + 1 thus:
- *
- * q[0..m] to Q[0..m] thus q[i] == Q[m-i]
- * r[1..n] R[0..N] r[i] == R[N+2-i]
- * u[0..m+n] w[0..m+N+1] u[i] == w[m+N+1-i]
- * v[1..n] x[0..N] v[i] == x[N+1-i]
- */
-
-/*
- * Note: Be very observent of the usage of uPtr, and vPtr.
- * They are used to point to u, v, w, q or r as necessary.
- */
-precision pdivmod(u, v, qp, rp)
- precision u, v, *qp, *rp;
-{
- register digitPtr uPtr, vPtr, qPtr, LastPtr;
-
- register accumulator temp; /* 0 <= temp < base^2 */
- register digit carry; /* 0 <= carry < 2 */
- register digit hi; /* 0 <= hi < base */
-
- register posit n, m;
- digit d; /* 0 <= d < base */
- digit qd; /* 0 <= qd < base */
-#ifdef DEBUG
- int i;
-#endif
-
- precision q, r, w; /* quotient, remainder, temporary */
-
- n = v->size; /* size of v and r */
-
- (void) pparm(u);
- (void) pparm(v);
- if (u->size < n) {
- q = pUndef;
- r = pUndef;
- pset(&q, pzero);
- pset(&r, u);
- goto done;
- }
-
- m = u->size - n;
-
- uPtr = u->value + m + n;
- vPtr = v->value + n;
-
- q = palloc(m + 1);
- if (q == pUndef) return q;
-
- q->sign = (u->sign != v->sign); /* can generate -0 */
-
- r = palloc(n);
- if (r == pUndef) {
- pdestroy(q);
- return r;
- }
- r->sign = u->sign;
-/*
- * watch out! does this function return: q=floor(a/b) or trunc(a/b)?
- * it's currently the latter, but every mathmaticion I have talked to
- * prefers the former so that a % b returns between 0 to b-1. The
- * problem is that this is slower and disagrees with C common practice.
- */
- qPtr = q->value + m + 1;
-
- if (n == 1) {
- d = *--vPtr; /* d is only digit of v */
- if (d == 0) { /* divide by zero? */
- q = pnew(errorp(PDOMAIN, "pdivmod", "divide by zero"));
- } else { /* single digit divide */
-#ifndef ASM_16BIT
- vPtr = r->value + n;
- hi = 0; /* hi is current remainder */
- do {
- temp = mulBase(hi); /* 0 <= temp <= (base-1)^2 */
- temp += *--uPtr; /* 0 <= temp <= base(base-1) */
- hi = uModDiv(temp, d, --qPtr); /* 0 <= hi < base */
- } while (uPtr > u->value);
- *--vPtr = hi;
-#else
- qPtr -= m + 1;
- *(r->value) = memdivw1(qPtr, u->value, m + 1, d);
-#endif
- }
- } else { /* muti digit divide */
- /*
- * normalize: multiply u and v by d so hi digit of v > b/2
- */
- d = BASE / (*--vPtr+1); /* high digit of v */
-
- w = palloc(n); /* size of v */
- if (w == pUndef) return w;
-
-#ifndef ASM_16BIT
- vPtr = v->value;
- uPtr = w->value; /* very confusing. just a temp */
- LastPtr = vPtr + n;
- hi = 0;
- do { /* single digit multiply */
- temp = uMul(*vPtr++, d); /* 0<= temp <= base(base-1)/2 */
- temp += hi; /* 0 <= temp <= (base^2-1)/2 */
- hi = divBase(temp); /* 0 <= hi < base / 2 */
- *uPtr++ = modBase(temp); /* 0 <= hi < base / 2 */
- } while (vPtr < LastPtr); /* on exit hi == 0 */
-#else
- hi = memmulw1(w->value, v->value, n, d);
-#endif
-
- pset(&v, w);
- pdestroy(w);
-
- w = palloc(m + n + 1);
- if (w == pUndef) return w;
-
-#ifndef ASM_16BIT
- uPtr = u->value;
- vPtr = w->value; /* very confusing. just a temp */
- LastPtr = uPtr + m + n;
- do { /* single digit multiply */
- temp = uMul(*uPtr++, d);
- temp += hi;
- hi = divBase(temp);
- *vPtr++ = modBase(temp);
- } while (uPtr < LastPtr);
- *vPtr = hi; /* note extra digit */
-#else
- hi = memmulw1(w->value, u->value, m + n, d);
- w->value[m + n] = hi;
-#endif
-
- pset(&u, w);
- pdestroy(w);
-
-#ifdef DEBUG
- printf("m = %d n = %d\nd = %d\n", m, n, d);
- printf("norm u = "); pshow(u);
- printf("norm v = "); pshow(v);
-#endif
-
- uPtr = u->value + m + 1; /* current least significant digit */
- do {
- --uPtr;
-#ifdef DEBUG
- printf(" u = ");
- for (i = n; i >= 0; --i) printf("%.*x ", sizeof(digit) * 2, uPtr[i]);
- putchar('\n');
- printf(" v = ");
- for (i = 1; i < 3; i++) printf("%.*x ", sizeof(digit) * 2,
- v->value[n-i]);
- putchar('\n');
-#endif
-#ifndef ASM_16BIT
- vPtr = v->value + n;
- LastPtr = uPtr + n;
- if (*LastPtr == *--vPtr) { /* guess next digit */
- qd = BASE - 1;
- } else {
- temp = mulBase(*LastPtr);
- temp += *--LastPtr; /* 0 <= temp< base^2 */
- temp = uModDiv(temp, *vPtr, &qd);
- --vPtr;
- --LastPtr;
- while (uMul(*vPtr, qd) > mulBase(temp) + *LastPtr) {
- --qd;
- temp += vPtr[1];
- if (temp >= BASE) break; /* if so, vPtr*qd <= temp*base */
- }
- LastPtr += 2;
- }
- /*
- * Single digit Multiply then Subtract
- */
- vPtr = v->value;
- carry = 1; /* noborrow bit */
- hi = 0; /* hi digit of multiply */
- do {
- /* multiply */
- temp = uMul(qd, *vPtr++); /* 0 <= temp <= (base-1)^2 */
- temp += hi; /* 0 <= temp <= base(base-1) */
- hi = divBase(temp);
- temp = modBase(temp);
- /* subtract */
- temp = (BASE-1) - temp; /* 0 <= temp < base */
- temp += *uPtr + carry; /* 0 <= temp < 2*base */
- carry = divBase(temp);
- *uPtr++ = modBase(temp); /* 0 <= carry < 2 */
- } while (uPtr < LastPtr);
- temp = (BASE-1) - hi;
- temp += *uPtr + carry;
- carry = divBase(temp);
- *uPtr = modBase(temp);
- uPtr -= n;
-#else
-#if 0
- carry = !memmulsubw(uPtr, v->value, n, qd); /* 1 if noborrow */
-#endif
- carry = !memdivw(uPtr, v->value, n, &qd); /* 1 if noborrow */
-#endif
-#ifdef DEBUG
- printf(" qhat = %.*x\n", sizeof(digit) * 2, qd);
- printf(" new u = ");
- for (i = n; i >= 0; --i) printf("%.*x ", sizeof(digit) * 2, uPtr[i]);
- putchar('\n');
-#endif
- if (carry == 0) { /* Test remainder, add back */
- vPtr = v->value;
- LastPtr = uPtr + n;
- do {
- temp = *uPtr + *vPtr++;
- temp += carry;
- carry = divBase(temp);
- *uPtr++ = modBase(temp);
- } while (uPtr < LastPtr);
- *uPtr += carry - BASE; /* real strange but works */
- uPtr -= n;
- --qd;
-#ifdef DEBUG
- printf(" decrementing q...adding back\n");
- printf(" fixed u = ");
- for (i = n; i >= 0; --i) printf("%.*x ", sizeof(digit) * 2, uPtr[i]);
- putchar('\n');
- printf(" newq = %.*x\n", sizeof(digit) * 2, qd);
-#endif
- }
- *--qPtr = qd; /* one leading zero possible */
-#ifdef DEBUG
- putchar('\n');
-#endif
- } while (uPtr > u->value);
-
- /*
- * Un-normalize to get remainder
- */
-#ifndef ASM_16BIT
- uPtr = u->value + n; /* skip hi digit (it's zero) */
- vPtr = r->value + n;
- hi = 0; /* hi is current remainder */
- do { /* single digit divide */
- temp = mulBase(hi); /* 0<=temp < base^2-(base-1) */
- temp += *--uPtr; /* 0 <= temp < base^2 */
- hi = uModDiv(temp, d, --vPtr);
- } while (uPtr > u->value); /* carry will be zero */
-#else
- carry = memdivw1(r->value, u->value, n, d); /* always 0 */
-#endif
- pnorm(r); /* remainder may have many leading 0's */
- }
-
- if (m > 0 && qPtr[m] == 0) {
- --(q->size); /* normalize */
- }
- if (q->size == 1 && *qPtr == 0) q->sign = false;
-
-done:
-
- pdestroy(u);
- pdestroy(v);
-
- if (rp == (precision *) -1) {
- if (qp != pNull) pset(qp, q);
- pdestroy(q);
- return presult(r);
- } else if (qp == (precision *) -1) {
- if (rp != pNull) pset(rp, r);
- pdestroy(r);
- return presult(q);
- }
- if (qp != pNull) pset(qp, q);
- if (rp != pNull) pset(rp, r);
- pdestroy(q);
- pdestroy(r);
- return pUndef;
-}
diff --git a/src/benchmarks/cfrac/pfactor.c b/src/benchmarks/cfrac/pfactor.c
deleted file mode 100644
index 6c765d1..0000000
--- a/src/benchmarks/cfrac/pfactor.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <stdio.h>
-#include "precision.h"
-#include "pfactor.h"
-
-void showfactors();
-
-
-int main(argc, argv)
- int argc;
- char *argv[];
-{
- precision n = pUndef;
-
- --argc;
- if (argc != 0) {
- do {
- pset(&n, atop(*++argv));
- showfactors(n);
- } while (--argc > 0);
- } else {
- do {
- pset(&n, fgetp(stdin));
- if (n == pUndef) break;
- showfactors(n);
- } while (1);
- }
- pdestroy(n);
- return 0;
-}
-
-void showfactors(n)
- precision n;
-{
- precision r = pUndef;
- FactorList factors = (FactorList) 0;
-
- (void) pparm(n);
- pset(&r, ptrial(n, (unsigned *) 0, &factors));
- fputp(stdout, n);
- fputs(" = ", stdout);
- pputfactors(stdout, factors);
- if pne(r, pone) {
- if pne(r, n) putc('*', stdout);
- if (!pprime(r, 16)) {
- fputc('(', stdout); fputp(stdout, r); fputc(')', stdout);
- } else {
- fputp(stdout, r);
- }
- }
- putc('\n', stdout);
-
- pfreefactors(&factors);
- pdestroy(r);
- pdestroy(n);
-}
diff --git a/src/benchmarks/cfrac/pfactor.h b/src/benchmarks/cfrac/pfactor.h
deleted file mode 100644
index edd5686..0000000
--- a/src/benchmarks/cfrac/pfactor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-typedef struct Pfs {
- struct Pfs *next;
- precision factor;
- unsigned count;
-} Pfactor;
-
-typedef Pfactor *FactorPtr;
-typedef FactorPtr FactorList;
-typedef precision (*pfunc)(); /* pointer to func returning precision */
-
-#ifndef __STDC__
-
-extern int pprime(); /* test whether a number is prime */
-extern precision pnextprime(); /* next prime >= it's argument */
-
-extern precision pgcd(); /* greatest common divisor */
-extern precision plcm(); /* least common multiple */
-extern precision peuclid(); /* extended euclid's algorithm */
-
-extern precision prho(); /* find factor using rho method */
-extern precision pfermat(); /* find factor using Fermat's method */
-extern precision pcfrac(); /* factor w/continued fractions */
-
-extern int prhoInit(); /* alter parameters for rho method */
-extern int pcfracInit(); /* alter paramteres for cfrac method */
-
-extern precision ptrial(); /* find factors using trial division */
-extern precision prfactor(); /* recursively factor a number */
-
-extern void paddfactor(); /* add a factor to a factorlist */
-extern void pputfactors(); /* print a factorlist */
-extern void pfreefactors(); /* return a factorlist to memory */
-
-#else
-
-extern int pprime(precision, unsigned trialCount);
-extern precision pnextprime(precision, unsigned trialCount);
-
-extern precision pgcd(precision, precision);
-extern precision plcm(precision, precision);
-extern precision peuclid(precision, precision, precision *, precision *);
-
-extern precision prho(precision n, unsigned *maxCount);
-extern precision pfermat(precision n, unsigned *maxCount);
-extern precision pcfrac(precision n, unsigned *maxCount);
-
-extern int prhoInit(precision c, unsigned batchSize);
-extern int pcfracInit(unsigned m, unsigned k, unsigned aborts);
-
-extern precision ptrial(precision n, unsigned *maxCount, FactorList *);
-extern precision prfactor(precision, unsigned *maxCount, pfunc, FactorList *);
-
-extern void paddfactor(FactorList *, precision);
-extern void pfreefactors(FactorList *);
-
-#ifndef BUFSIZE
-#include <stdio.h>
-#endif
-
-extern void pputfactors(FILE *, FactorList);
-
-#endif
diff --git a/src/benchmarks/cfrac/pfloat.c b/src/benchmarks/cfrac/pfloat.c
deleted file mode 100644
index 63f4344..0000000
--- a/src/benchmarks/cfrac/pfloat.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * High Precision Math Library Supplement for floating point routines
- */
-#include <stdio.h>
-#include <math.h>
-#include "pdefs.h"
-#include "pcvt.h"
-#include "precision.h"
-
-extern precision palloc();
-
-/*
- * double to precision
- */
-precision dtop(f)
- register double f;
-{
- register digitPtr uPtr;
- register precision u;
-
- u = palloc(DOUBLESIZE); /* pretty big */
- if (u == pUndef) return u;
-
- if (f < 0.0) {
- f = -f;
- u->sign = true;
- } else {
- u->sign = false;
- }
- uPtr = u->value;
- do {
- *uPtr++ = fmod(f, (double) BASE);
- f = floor(f / (double) BASE);
- } while (f != 0.0);
-
- u->size = (uPtr - u->value);
-
- return presult(u);
-}
-
-/*
- * precision to double (no overflow check)
- */
-double ptod(u)
- precision u;
-{
- register digitPtr uPtr;
- register double f;
-
- (void) pparm(u);
- uPtr = u->value + u->size;
- f = 0.0;
- do {
- f = f * (double) BASE + (double) *--uPtr;
- } while (uPtr > u->value);
-
- if (u->sign) f = -f;
-
- pdestroy(u);
- return f;
-}
diff --git a/src/benchmarks/cfrac/pgcd.c b/src/benchmarks/cfrac/pgcd.c
deleted file mode 100644
index a72a8a7..0000000
--- a/src/benchmarks/cfrac/pgcd.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "precision.h"
-
-/*
- * Euclid's Algorithm
- *
- * Given u and v, calculated and return their greatest common divisor.
- */
-precision pgcd(u, v)
- precision u, v;
-{
- precision u3 = pnew(pabs(pparm(u))), v3 = pnew(pabs(pparm(v)));
- precision q = pUndef, r = pUndef;
-
- while (pnez(v3)) {
- pdivmod(u3, v3, &q, &r);
- pset(&u3, v3);
- pset(&v3, r);
- }
-
- pdestroy(v3);
- pdestroy(q); pdestroy(r);
- pdestroy(u); pdestroy(v);
- return presult(u3); /* result always positive */
-}
diff --git a/src/benchmarks/cfrac/phalf.c b/src/benchmarks/cfrac/phalf.c
deleted file mode 100644
index 8658de5..0000000
--- a/src/benchmarks/cfrac/phalf.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <string.h>
-#include "pdefs.h"
-#include "precision.h"
-
-#ifdef ASM_16BIT
-#include "asm16bit.h"
-#endif
-
-/*
- * Divide a precision by 2
- */
-precision phalf(u)
- register precision u;
-{
-#ifdef ASM_16BIT
- register precision w;
- register posit usize;
-
- pparm(u);
- usize = u->size;
- w = palloc(usize);
- if (w == pUndef) return w;
-
- w->sign = u->sign;
- (void) memcpy(w->value, u->value, usize * sizeof(digit));
-
- memlsrw(w->value, usize); /* 68000 assembly language routine */
- if (usize > 1 && w->value[usize-1] == (digit) 0) { /* normalize */
- --(w->size);
- }
- pdestroy(u);
- return presult(w);
-#else
- return pdiv(u, ptwo);
-#endif
-}
diff --git a/src/benchmarks/cfrac/picmp.c b/src/benchmarks/cfrac/picmp.c
deleted file mode 100644
index b942268..0000000
--- a/src/benchmarks/cfrac/picmp.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-
-static char cmpError[] = "Second arg not single digit";
-
-/*
- * Single-digit compare
- */
-int picmp(u, v)
- register precision u;
- register int v;
-{
- register int i;
-
- (void) pparm(u);
-
- if (u->sign) {
- i = -1;
- if (v < 0) {
- if (-v >= BASE) {
- errorp(PDOMAIN, "picmp", cmpError);
- }
- if (u->size == 1) {
- i = - (int) *(u->value) - v;
- }
- }
- } else {
- i = 1;
- if (v >= 0) {
- if (v >= BASE) {
- errorp(PDOMAIN, "picmp", cmpError);
- }
- if (u->size == 1) {
- i = (int) *(u->value) - v;
- }
- }
- }
-
- pdestroy(u);
- return i;
-}
diff --git a/src/benchmarks/cfrac/pidiv.c b/src/benchmarks/cfrac/pidiv.c
deleted file mode 100644
index 61c09a7..0000000
--- a/src/benchmarks/cfrac/pidiv.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-#ifdef ASM_16BIT
-#include "asm16bit.h"
-#endif
-
-/*
- * Single-digit divide
- */
-precision pidiv(u, v)
- register precision u;
- int v;
-{
-#ifndef ASM_16BIT
- register digitPtr uPtr, qPtr;
- register accumulator temp; /* 0 <= temp < base^2 */
-#endif
- register digit r, d; /* 0 <= r,d < base */
- register posit m;
- register precision q;
-
- (void) pparm(u);
-
- if (v < 0) d = (digit) -v; else d = (digit) v;
- if (d >= BASE) {
- q = pnew(errorp(PDOMAIN, "pidiv", "divisor too big for single digit"));
- goto done;
- }
- if (d == 0) {
- q = pnew(errorp(PDOMAIN, "pidiv", "divide by zero"));
- goto done;
- }
- m = u->size;
- q = palloc(m);
- if (q == pUndef) goto done;
-
-#ifndef ASM_16BIT
- qPtr = q->value + m;
- uPtr = u->value + m;
- r = 0; /* r is current remainder */
- do {
- temp = mulBase(r); /* 0 <= temp <= (base-1)^2 */
- temp += *--uPtr; /* 0 <= temp <= base(base-1) */
- r = uModDiv(temp, d, --qPtr); /* 0 <= r < base */
- } while (uPtr > u->value);
-#else
- r = memdivw1(q->value, u->value, m, d);
-#endif
- /*
- * normalize q
- */
- if (m > 1 && q->value[m-1] == 0) {
- --(q->size);
- }
- q->sign = (u->sign != (v < 0));
- if (q->size == 1 && *(q->value) == 0) q->sign = false;
-done:
- pdestroy(u);
- return presult(q);
-}
diff --git a/src/benchmarks/cfrac/pimod.c b/src/benchmarks/cfrac/pimod.c
deleted file mode 100644
index b26536d..0000000
--- a/src/benchmarks/cfrac/pimod.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-#ifdef ASM_16BIT
-#include "asm16bit.h"
-#endif
-
-/*
- * Single-digit remainder
- */
-int pimod(u, v)
- register precision u;
- int v;
-{
-#ifndef ASM_16BIT
- register digitPtr uPtr;
- register accumulator temp; /* 0 <= temp < base^2 */
-#endif
- register digit r = 0, d; /* 0 <= r,d < base */
- register int res = 0;
-
- (void) pparm(u);
- if (v < 0) d = (digit) -v; else d = (digit) v;
- if (d >= BASE) {
- errorp(PDOMAIN, "pimod", "divisor too big for single digit");
- goto done;
- }
- if (d == 0) {
- errorp(PDOMAIN, "pimod", "divide by zero");
- goto done;
- }
-#ifndef ASM_16BIT
- uPtr = u->value + u->size;
- r = 0; /* r is current remainder */
- do {
- temp = mulBase(r); /* 0 <= temp <= (base-1)^2 */
- temp += *--uPtr; /* 0 <= temp <= base(base-1) */
- r = temp % d; /* 0 <= r < base */
- } while (uPtr > u->value);
-#else
- r = memmodw1(u->value, u->size, d);
-#endif
-
- res = (int) r;
- if (u->sign) res = -res;
-done:
- pdestroy(u);
- return res;
-}
diff --git a/src/benchmarks/cfrac/pio.c b/src/benchmarks/cfrac/pio.c
deleted file mode 100644
index 16b5bda..0000000
--- a/src/benchmarks/cfrac/pio.c
+++ /dev/null
@@ -1,165 +0,0 @@
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include "pdefs.h"
-#include "pcvt.h"
-#include "precision.h"
-
-/*
- * Output a string to a file.
- *
- * Returns:
- * the number of characters written
- * or EOF if error
- */
-static int fouts(stream, chp)
- FILE *stream;
- register char *chp;
-{
- register int count = 0, res = 0;
-
- if (chp != (char *) 0 && *chp != '\0') do {
- count++;
- res = putc(*chp, stream);
- } while (*++chp != '\0' && res != EOF);
-
- if (res != EOF) res = count;
- return res;
-}
-
-/*
- * output the value of a precision to a file (no cr or whitespace)
- *
- * Returns:
- * The number of characters output or EOF if error
- */
-int fputp(stream, p)
- FILE *stream;
- precision p;
-{
- int res;
- char *chp = ptoa(pparm(p));
-
- res = fouts(stream, chp);
- deallocate(chp);
- pdestroy(p);
- return res;
-}
-
-/*
- * Output a precision to stdout with a newline (useful from debugger)
- */
-int putp(p)
- precision p;
-{
- int res;
- char *chp = ptoa(pparm(p));
-
- res = fouts(stdout, chp);
- res = putc('\n', stdout);
- deallocate(chp);
- pdestroy(p);
- return res;
-
-}
-
-/*
- * Output a justified precision
- *
- * Returns: The number of characters in the precision, or EOF if error
- */
-int fprintp(stream, p, minWidth)
- FILE *stream;
- precision p;
- register int minWidth;
-{
- int res;
- char *chp = ptoa(pparm(p));
- int len;
-
- len = strlen(chp);
- if (minWidth < 0) { /* left-justified */
- res = fouts(stream, chp);
- while (minWidth++ < -len) {
- putc(' ', stream);
- }
- } else {
- while (minWidth-- > len) { /* right-justified */
- putc(' ', stream);
- }
- res = fouts(stream, chp);
- }
-
- deallocate(chp);
- pdestroy(p);
- return res;
-}
-
-
-/*
- * Read in a precision type - same as atop but with io
- *
- * leading whitespace skipped
- * an optional leading '-' or '+' followed by digits '0'..'9'
- * leading 0's Ok
- * stops at first unrecognized character
- *
- * Returns: pUndef if EOF or invalid argument (NULL or nondigit as 1st digit)
- */
-precision fgetp(stream)
- FILE *stream;
-{
- precision res = pUndef;
- precision clump = pUndef;
- int sign = 0;
- register int ch;
- register accumulator temp, x;
- register int j;
-
- ch = getc(stream);
- if (ch != EOF) {
- while (isspace(ch)) ch = getc(stream); /* skip whitespace */
- if (ch == '-') {
- sign = 1;
- ch = getc(stream);
- } else if (ch == '+') {
- ch = getc(stream);
- }
- if (isdigit(ch)) {
- pset(&res, pzero);
- pset(&clump, utop(aDigit));
- do {
- j = aDigitLog-1;
- temp = ch - '0';
- do {
- if (!isdigit(ch = getc(stream))) goto atoplast;
- temp = temp * aBase + (ch - '0');
- } while (--j > 0);
- pset(&res, padd(pmul(res, clump), utop(temp)));
- } while (isdigit(ch = getc(stream)));
- goto atopdone;
-atoplast:
- x = aBase;
- while (j++ < aDigitLog-1) {
- x *= aBase;
- }
- pset(&res, padd(pmul(res, utop(x)), utop(temp)));
-atopdone:
- if (ch != EOF) ungetc(ch, stream);
- if (sign) {
- pset(&res, pneg(res));
- }
- } else {
- if (ch == EOF) {
- res = pUndef;
- } else {
- ungetc(ch, stream);
- }
- }
- } else {
- res = pUndef;
- }
- pdestroy(clump);
- if (res == pUndef) return res;
- return presult(res);
-}
diff --git a/src/benchmarks/cfrac/pmul.c b/src/benchmarks/cfrac/pmul.c
deleted file mode 100644
index e69a366..0000000
--- a/src/benchmarks/cfrac/pmul.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-#include <string.h>
-
-#ifdef ASM_16BIT
-#include "asm16bit.h"
-#endif
-
-/*
- * Multiply u by v (assumes normalized)
- */
-precision pmul(u, v)
- register precision v; /* register a5 on 68000 */
-#ifdef ASM_16BIT
- register precision u; /* register a4 */
-{
-#else
- precision u;
-{
- digitPtr vPtr;
- register digitPtr uPtr, wPtr, HiDigit;
- register accumulator temp; /* 0 <= temp < base * base */ /* d7 */
- register digit vdigit; /* d6 */
-#endif
- register digit hi; /* 0 <= hi < base */ /* d5 */
- precision w;
-
- (void) pparm(u);
- (void) pparm(v);
- /*
- * Check for multiply by zero. Helps prevent wasted storage and -0
- */
- if (peqz(u) || peqz(v)) {
- w = palloc(1);
- if (w == pUndef) return w;
-
- w->sign = false;
- w->value[0] = 0;
- } else {
- if (u->size < v->size) { /* u is biggest number (for inner loop speed) */
- w = u; u = v; v = w;
- }
-
- w = palloc(u->size + v->size);
- if (w == pUndef) return w;
-
- w->sign = (u->sign != v->sign);
-
-#ifndef ASM_16BIT
- uPtr = u->value;
- vPtr = v->value;
- wPtr = w->value + u->size; /* this is correct! */
- do {
- *--wPtr = 0;
- } while (wPtr > w->value);
-
- vPtr = v->value;
- HiDigit = u->value + u->size;
- do {
- uPtr = u->value;
- wPtr = w->value + (vPtr - v->value);
- hi = 0;
- vdigit = *vPtr;
- do {
- temp = uMul(vdigit, *uPtr++); /* 0 <= temp <= (base-1)^2 */
- temp += *wPtr; /* 0 <= temp <= base(base-1) */
- temp += hi; /* 0 <= temp < base * base */
- hi = divBase(temp); /* 0 <= hi < base */
- *wPtr++ = modBase(temp);
- } while (uPtr < HiDigit);
- *wPtr++ = hi;
- } while (++vPtr < v->value + v->size);
-#else
- hi = memmulw(w->value, u->value, u->size, v->value, v->size);
-#endif
- if (hi == 0) {
- --(w->size); /* normalize */
- }
- }
-
- pdestroy(u);
- pdestroy(v);
- return presult(w);
-}
diff --git a/src/benchmarks/cfrac/pneg.c b/src/benchmarks/cfrac/pneg.c
deleted file mode 100644
index c781066..0000000
--- a/src/benchmarks/cfrac/pneg.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "pdefs.h" /* private include file */
-#include "precision.h" /* public include file for forward refs */
-#include <string.h>
-
-/*
- * negation
- */
-precision pneg(u)
- register precision u;
-{
- precision w;
-
- (void) pparm(u);
- w = palloc(u->size);
- if (w == pUndef) return w;
-
- w->sign = u->sign;
- if (pnez(u)) { /* don't create a negative 0 */
- w->sign = !w->sign;
- }
- (void) memcpy(w->value, u->value, u->size * sizeof(digit));
-
- pdestroy(u);
- return presult(w);
-}
diff --git a/src/benchmarks/cfrac/podd.c b/src/benchmarks/cfrac/podd.c
deleted file mode 100644
index def95b4..0000000
--- a/src/benchmarks/cfrac/podd.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-
-/*
- * Returns non-zero if u is odd
- */
-int podd(u)
- precision u;
-{
- register int res;
-
- (void) pparm(u);
- res = (*(u->value) & 1);
- pdestroy(u);
- return res;
-}
diff --git a/src/benchmarks/cfrac/pops.c b/src/benchmarks/cfrac/pops.c
deleted file mode 100644
index 7154dd7..0000000
--- a/src/benchmarks/cfrac/pops.c
+++ /dev/null
@@ -1,339 +0,0 @@
-#ifdef DEBUGOPS
-#include <stdio.h>
-#endif
-/*
- * High Precision Math Library
- *
- * Written by Dave Barrett 2/23/83
- * Translated from modcal to pascal 4/30/84
- * Mod portability fixed; removed floor function 5/14/84
- * Fixed numerous bugs and improved robustness 5/21/84
- * Translated to C 6/14/84
- * Changed precision to be determined at run-time 5/19/85
- * Added dynamic allocation 7/21/85
- * Combined unsigned math and integer math 8/01/85
- * Fixed Bug in pcmp 7/20/87
- * Fixed handling of dynamic storage (refcount added) 7/20/87
- * Final debugging of current version 8/22/87
- * Fixed many bugs in various routines, wrote atop 2/07/89
- * Tuned for speed, fixed overflow problems 3/01/89
- * Removed refcounts, more tuning, removed pcreate 3/16/89
- * Added cmp macros, change name of pzero, added pshift 4/29/89
- * Repaired operation order bugs in pdiv, calc.c 5/15/91
- * Added pdiv macro, split out pcmp, pabs, much cleanup 5/21/91
- *
- * warning! The mod operation with negative arguments not portable.
- * I have therefore avoided it completely with much pain.
- *
- * The following identities have proven useful:
- *
- * given: a % b = a - floor(a/b) * b
- * then : -a % -b = -(a % b)
- * -a % b = -( a % -b) = b - a % b (a % b != 0)
- * a % -b = -(-a % b) = a % b - b (a % b != 0)
- *
- * given: a % b = a - a / b * b
- * then : -a % -b = -a % b = -(a % b)
- * a % -b = a % b
- *
- * Also, be very careful of computations in the inner loops. Much
- * work has been done to make sure the compiler does not re-arrange
- * expressions to cause an overflow. The compiler may still be doing
- * unnecessary type conversions.
- *
- * NOTES:
- *
- * The ptoa routine creates storage which is likely to be forgotton.
- *
- * A function returning a result must use the result. If it doesn't
- * the storage is never freed. For example: itop(2); by itself
- * You must make sure to pdestroy the result.
- *
- * An error (out of storage) fails to deallocate u and v.
- *
- * psub, pcmp, pdiv, and pmul all assume normalized arguments.
- *
- * This file contains the storage management-specific code:
- * palloc, pfree, pset -- together these account for 45% of execution time
- */
-#include <string.h>
-#include "pdefs.h" /* private include file */
-#include "precision.h" /* public include file for forward refs */
-
-cacheType pcache[CACHESIZE];
-static char ident[] =
- " @(#) libprecision.a version 2.00 3-May-91 by Dave Barrett\n";
-
-/*
- * normalize (used by div and sub)
- * remove all leading zero's
- * force positive sign if result is zero
- */
-void pnorm(u)
- register precision u;
-{
- register digitPtr uPtr;
-
- uPtr = u->value + u->size;
- do {
- if (*--uPtr != 0) break;
- } while (uPtr > u->value);
-
- if (uPtr == u->value && *uPtr == 0) u->sign = false;
-
- u->size = (uPtr - u->value) + 1; /* normalize */
-}
-
-/*
- * Create a number with the given size (private) (very heavily used)
- */
-precision palloc(size)
- register posit size;
-{
- register precision w;
- register cacheType *kludge = pcache + size; /* for shitty compilers */
-
-#if !(defined(NOMEMOPT) || defined(BWGC))
- if (size < CACHESIZE && (w = kludge->next) != pUndef) {
- kludge->next = ((cacheType *) w)->next;
- --kludge->count;
- } else {
-#endif
- w = (precision) allocate(PrecisionSize + sizeof(digit) * size);
- if (w == pUndef) {
- w = errorp(PNOMEM, "palloc", "out of memory");
- return w;
- }
-#if !(defined(NOMEMOPT) || defined(BWGC))
- }
-#endif
-#ifndef BWGC
- w->refcount = 1;
-#endif
- w->size = w->alloc = size;
-#ifdef DEBUGOPS
- printf("alloc %.8x\n", w);
- fflush(stdout);
-#endif
- return w;
-}
-
-/*
- * (Very heavily used: Called conditionally pdestroy)
- * (should be void, but some compilers can't handle it with the macro)
- */
-int pfree(u)
- register precision u;
-{
- register posit size;
- register cacheType *kludge; /* for shitty compilers */
-
-#ifdef DEBUGOPS
- printf("free %.8x\n", u);
- fflush(stdout);
-#endif
-
- size = u->alloc;
-
- kludge = pcache + size;
-#if !(defined(NOMEMOPT) || defined(BWGC))
- if (size < CACHESIZE && kludge->count < CACHELIMIT) {
- ((cacheType *) u)->next = kludge->next;
- kludge->next = u;
- kludge->count++;
- } else {
-#endif
- deallocate(u);
-#if !(defined(NOMEMOPT) || defined(BWGC))
- }
-#endif
- return 0;
-}
-
-/*
- * User inteface:
- *
- * Rules:
- * a precision must be initialized to pUndef or to result of pnew.
- * a precision pointer must point to a precision or be pNull
- * pUndef may not be passed as an rvalue into a function
- * pNull may not be passed as an lvalue into a function
- *
- * presult and pdestroy are the only functions which may be passed pUndef
- */
-
-/*
- * assignment with verification (slower, but helpful for bug detect)
- * It would be nice if this routine could detect pointers to incorrect
- * or non-living areas of memory.
- *
- * We can't check for undefined rvalue because we want to allow functions
- * to return pUndef, and then let the application check for it after assigning
- * it to a variable.
- *
- * usage: pset(&i, j);
- */
-precision psetv(up, v)
- register precision *up, v;
-{
- register precision u;
-
-#ifdef DEBUGOPS
- printf("psetv %.8x %.8x ", up, v);
-#endif
-#ifdef DEBUGOPS
-#ifndef BWGC
- printf("->%u", v->refcount);
-#endif
-#endif
- if (up == pNull) {
- errorp(PDOMAIN, "pset", "lvalue is pNull");
- }
- u = *up;
-#ifdef DEBUGOPS
- printf(" %.8x", u);
-#endif
- *up = v;
- if (v != pUndef) {
-#ifndef BWGC
- v->refcount++;
-#endif
- }
- if (u != pUndef) {
- if (u->sign & ~1) { /* a minimal check */
- errorp(PDOMAIN, "pset", "invalid precision");
- }
-#ifndef BWGC
- if (--(u->refcount) == 0) {
-#ifdef DEBUGOPS
- printf("->%u", u->refcount);
-#endif
- pfree(u);
- }
-#endif
- }
-#ifdef DEBUGOPS
- putchar('\n');
- fflush(stdout);
-#endif
- return v;
-}
-
-precision pparmv(u)
- register precision u;
-{
-#ifdef DEBUGOPS
- printf("pparm %.8x\n", u);
- fflush(stdout);
-#endif
- if (u == pUndef) {
- errorp(PDOMAIN, "pparm", "undefined function argument");
- }
- if (u->sign & ~1) { /* a minimal check */
- errorp(PDOMAIN, "pparm", "invalid precision");
- }
-#ifndef BWGC
- u->refcount++;
-#endif
- return u;
-}
-
-/*
- * Function version of unsafe pparmq macro
- */
-precision pparmf(u)
- register precision u;
-{
-#ifndef BWGC
- if (u != pUndef) {
- u->refcount++;
- }
-#endif
- return u;
-}
-
-/*
- * Function version of pdestroy macro
- */
-void pdestroyf(u)
- register precision u;
-{
-#ifndef BWGC
- if (u != pUndef && --u->refcount == 0) {
- pfree(u);
- }
-#endif
-}
-
-#ifndef __GNUC__ /* inline in header file */
-/*
- * We cannot allow this to be a macro because of the probability that it's
- * argument will be a function (e.g. utop(2))
- */
-precision pnew(u)
- register precision u;
-{
-#ifndef BWGC
- u->refcount++;
-#endif
- return u;
-}
-
-/*
- * Cannot be a macro because of function argument possibility
- */
-precision presult(u)
- register precision u;
-{
-#ifndef BWGC
- if (u != pUndef) {
- --(u->refcount);
- }
-#endif
- return u;
-}
-
-/*
- * Quick but dangerous assignment
- *
- * Assumes: target not pNull and source not pUndef
- */
-precision psetq(up, v)
- register precision *up, v;
-{
- register precision u = *up; /* up may NOT be pNULL! */
-
- *up = v; /* up may be &v, OK */
-#ifndef BWGC
- if (v != pUndef) { /* to allow: x=func(); if (x==pUndef) ... */
- v->refcount++;
- }
- if (u != pUndef && --(u->refcount) == 0) {
- pfree(u);
- }
-#endif
- return v;
-}
-#endif
-
-#if 0 /* original assignment code */
-precision pset(up, v)
- register precision *up, v;
-{
- register precision u;
-
-#ifndef BWGC
- if (v != pUndef) v->refcount++;
-#endif
- if (up == pNull) { /* useful voiding parameters (pdiv) */
- pdestroy(v);
- return pUndef;
- }
- u = *up;
- if (u != pUndef) { /* useful to force initial creation */
- pdestroy(u);
- }
- *up = v; /* notice that v may be pUndef which is OK! */
- return v; /* no presult! This is a variable */
-}
-#endif
diff --git a/src/benchmarks/cfrac/ppowmod.c b/src/benchmarks/cfrac/ppowmod.c
deleted file mode 100644
index 4528db9..0000000
--- a/src/benchmarks/cfrac/ppowmod.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "precision.h"
-
-/*
- * Raise to precision power mod m
- */
-precision ppowmod(u, v, m)
- precision u, v, m;
-{
- precision j = pUndef, i = pUndef, n = pUndef;
-
- (void) pparm(m);
- pset(&i, pparm(u));
- pset(&n, pparm(v));
- pset(&j, pone);
-
- do {
- if (podd(n)) {
- pset(&j, pmod(pmul(i, j), m));
- }
- pset(&n, phalf(n));
- if (peqz(n)) break;
- pset(&i, pmod(pmul(i, i), m));
- } while (1);
-
- pdestroy(i); pdestroy(n);
- pdestroy(u); pdestroy(v); pdestroy(m);
- return presult(j);
-}
diff --git a/src/benchmarks/cfrac/precision.h b/src/benchmarks/cfrac/precision.h
deleted file mode 100644
index 28befce..0000000
--- a/src/benchmarks/cfrac/precision.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Arbitrary precision integer math package
- *
- * (c) Copyright 1991 by David A. Barrett (barrett@asgard.UUCP)
- *
- * Not to be used for profit or distributed in systems sold for profit
- */
-
-
-/* BEGIN EDB */
-
-#include <stdlib.h>
-
-#if defined(USE_LOCH) && defined(_WIN32)
-#pragma comment(lib, "loch.lib")
-#endif
-
-#define NOMEMOPT 1
-
-/* END EDB */
-
-#ifndef BASE
-typedef unsigned short prefc; /* reference counter type */
-typedef prefc *precision; /* this a a private data structure */
-extern int pfree(); /* free (private) */
-#endif
-
-typedef precision *pvector; /* a vector of precision */
-typedef pvector *parray; /* 2d array */
-
-/*
- * Error values passed to errorp
- */
-#define PNOERROR 0
-#define PNOMEM 1
-#define PREFCOUNT 2
-#define PUNDEFINED 3
-#define PDOMAIN 4
-#define POVERFLOW 5
-
-#define pUndef ((precision) 0) /* An undefined value */
-#define pNull ((precision *) 0)
-
-#define peq(u, v) (pcmp((u), (v)) == 0)
-#define pne(u, v) (pcmp((u), (v)) != 0)
-#define pgt(u, v) (pcmp((u), (v)) > 0)
-#define plt(u, v) (pcmp((u), (v)) < 0)
-#define pge(u, v) (pcmp((u), (v)) >= 0)
-#define ple(u, v) (pcmp((u), (v)) <= 0)
-
-#define peqz(u) (pcmpz(u) == 0)
-#define pnez(u) (pcmpz(u) != 0)
-#define pltz(u) (pcmpz(u) < 0)
-#define pgtz(u) (pcmpz(u) > 0)
-#define plez(u) (pcmpz(u) <= 0)
-#define pgez(u) (pcmpz(u) >= 0)
-
-#define peven(u) (!podd(u))
-#define pdiv(u,v) (pdivmod(u,v, (precision *) -1, pNull))
-#define pmod(u,v) (pdivmod(u,v, pNull, (precision *) -1))
-#define pdivr(u,v,r) (pdivmod(u,v, (precision *) -1, r))
-#define pmodq(u,v,q) (pdivmod(u,v, q, (precision *) -1))
-
-/*
- * Application programs should only use the following definitions;
- *
- * pnew, pdestroy, pparm, presult and pset
- *
- * Other variants are internal only!
- * All are side-effect safe except for pparm and presult.
- * -DDEBUG will enable argument checking for pset and pparm
- */
-#ifdef __GNUC__ /* inline is NOT ansii! Sigh. */
-#ifndef BWGC
-static inline precision pnew(precision u) { (* (prefc *) u)++; return u; }
-static inline void pdestroy(precision u) {
- if (u != pUndef && --(*(prefc *) u) == 0) pfree(u);
-}
-static inline precision pparmq(precision u) {
- if (u != pUndef) (* (prefc *) u)++; return u;
-}
-static inline precision presult(precision u) {
- if (u != pUndef) --(*(prefc *) u); return u;
-}
-static inline precision psetq(precision *up, precision v) {
- precision u = *up;
- *up = v;
- if (v != pUndef) (* (prefc *) v)++;
- if (u != pUndef && --(* (prefc *) u) == 0) pfree(u);
- return v;
-}
-#define pvoid(u) pdestroy(u)
-#else
-extern inline precision pnew(precision u) { return u; }
-extern inline void pdestroy(precision u) {}
-extern inline precision pparmq(precision u) { return u; }
-extern inline precision presult(precision u) { return u; }
-extern inline precision psetq(precision *up, precision v) {
- precision u = *up;
- *up = v;
- return v;
-}
-#define pvoid(u) pdestroy(u)
-#endif
-#else
-#ifndef BWGC
-#define pdestroy(u) (void) ((u)!=pUndef&&--(*(prefc *)(u))==0&&pfree(u))
-#define pparmq(u) ((u) != pUndef && (* (prefc *) (u))++, (u))
-#define pvoid(u) pdestroyf(u)
-#else
-#define pdestroy(u) (void) (0)
-#define pparmq(u) (u)
-#define pvoid(u) pdestroyf(u)
-#endif
-#endif
-
-
-#ifdef PDEBUG
-#define pset(u, v) psetv(u, v)
-#define pparm(u) pparmv(u)
-#else
-#define pset(u, v) psetq(u, v)
-#define pparm(u) pparmq(u)
-#endif
-
-#ifdef __STDC__ /* if ANSI compiler */
-#ifndef __GNUC__
-extern precision pnew(precision); /* initialization */
-extern precision presult(precision); /* function result */
-extern precision psetq(precision *, precision); /* quick assignment */
-#endif
-extern precision psetv(precision *, precision); /* checked assignment */
-extern precision pparmv(precision); /* checked parameter */
-extern precision pparmf(precision); /* unchecked parameter (fn) */
-
-extern int pcmpz(precision); /* compare to zero */
-extern int pcmp(precision, precision); /* compare */
-extern int picmp(precision, int); /* single digit cmp */
-
-extern precision padd(precision, precision); /* add */
-extern precision psub(precision, precision); /* subtract */
-extern precision pmul(precision, precision); /* multiply */
-
-extern precision pdivmod(precision, precision,
- precision *q, precision *r);
-
-extern precision pidiv(precision, int); /* single digit pdiv */
-extern int pimod(precision, int); /* single digit pmod */
-extern void pidivmod(precision, int, /* single pdivmod */
- precision *q, int *r);
-
-extern precision pneg(precision); /* negate */
-extern precision pabs(precision); /* absolute value */
-extern int podd(precision); /* true if odd */
-extern precision phalf(precision); /* divide by two */
-
-extern precision pmin(precision, precision); /* minimum value */
-extern precision pmax(precision, precision); /* maximum value */
-
-extern precision prand(precision); /* random number generator */
-
-extern precision itop(int); /* int to precision */
-extern precision utop(unsigned); /* unsigned to precision */
-extern precision ltop(long); /* long to precision */
-extern precision ultop(unsigned long); /* unsigned long to precision */
-
-extern int ptoi(precision); /* precision to int */
-extern unsigned int ptou(precision); /* precision to unsigned */
-extern long ptol(precision); /* precision to long */
-extern unsigned long ptoul(precision); /* precision to unsigned long */
-
-extern precision atop(char *); /* ascii to precision */
-extern char *ptoa(precision); /* precision to ascii */
-
-extern int btop(precision *result, /* base to precision */
- char *src, unsigned size, int *digitmap, unsigned radix);
-
-extern int /* precision to base */
- ptob(precision, char *result, unsigned size, char *alphabet, unsigned radix);
-
-/*
- * Can't do prototyping for these unless stdio.h has been included
- */
-#ifdef BUFSIZ
-extern precision fgetp(FILE *stream); /* input precision */
-extern int fputp(FILE *stream, precision); /* output precision */
-extern int
- fprintp(FILE *stream, precision, int minWidth); /* output within a field */
-#else
-extern precision fgetp(); /* input precision */
-extern int fputp(); /* output precision */
-extern int fprintp(); /* output within a field */
-#endif
-
-extern int putp(precision); /* stdout with '\n' */
-
-extern void pshow(precision); /* display debug info */
-extern precision prandnum(); /* debug and profil only */
-extern precision pshift(precision, int); /* shift left */
-
-extern precision errorp(int errnum, char *routine, char *message);
-
-extern precision pzero, pone, ptwo; /* constants 0, 1, and 2 */
-extern precision p_one; /* constant -1 */
-
-extern precision psqrt(precision); /* square root */
-extern precision pfactorial(precision); /* factorial */
-extern precision pipow(precision, unsigned); /* unsigned int power */
-extern precision ppow(precision, precision); /* precision power */
-extern precision
- ppowmod(precision, precision, precision); /* precision power mod m */
-extern int plogb(precision, precision); /* log base b of n */
-
-extern precision dtop(double); /* double to precision */
-extern double ptod(precision); /* precision to double */
-
-/*
- * vector operations
- */
-pvector pvundef(pvector, unsigned size); /* local variable entry */
-void pvdestroy(pvector, unsigned size); /* local variable exit */
-
-pvector pvalloc(unsigned size); /* pvec allocate */
-void pvfree(pvector, unsigned size); /* pvec free */
-
-pvector pvset(pvector, unsigned size, precision value);
-
-#else
-
-/*
- * Function versions of above if you still want side effects
- */
-
-#ifndef __GNUC__
-extern precision pnew(); /* initialization */
-extern precision presult(); /* function result */
-extern precision psetq(); /* quick assignment */
-#endif
-extern precision psetv(); /* checked assignment */
-extern precision pparmv(); /* checked parameter */
-extern precision pparmf(); /* unchecked parameter (fn) */
-
-extern int pcmpz(); /* compare to zero */
-extern int pcmp(); /* compare */
-extern int picmp(); /* single digit compare */
-
-extern precision padd(); /* add */
-extern precision psub(); /* subtract */
-extern precision pmul(); /* multiply */
-
-extern precision pdivmod(); /* divide/remainder */
-extern void pidivmod(); /* single digit divide/remainder */
-extern precision pidiv(); /* single digit divide */
-extern int pimod(); /* single digit remainder */
-extern precision pneg(); /* negate */
-extern precision pabs(); /* absolute value */
-extern int podd(); /* true if odd */
-extern precision phalf(); /* divide by two */
-
-extern precision pmin(); /* minimum value */
-extern precision pmax(); /* maximum value */
-
-extern precision prand(); /* random number generator */
-
-extern precision itop(); /* int to precision */
-extern precision utop(); /* unsigned to precision */
-extern precision ltop(); /* long to precision */
-extern precision ultop(); /* unsigned long to precision */
-
-extern int ptoi(); /* precision to int */
-extern unsigned int ptou(); /* precision to unsigned */
-extern long ptol(); /* precision to long */
-extern unsigned long ptoul(); /* precision to unsigned long */
-
-extern precision atop(); /* ascii to precision */
-extern char *ptoa(); /* precision to ascii */
-
-extern int btop(); /* base to precision */
-extern int ptob(); /* precision to base */
-
-extern precision fgetp(); /* input a precision */
-extern int fputp(); /* output a precision */
-extern int putp(); /* output precision '\n' to stdout */
-extern int fprintp(); /* output a precision within a field */
-
-extern void pshow(); /* display debug info */
-extern precision prandnum(); /* for debug and profil only */
-extern precision pshift(); /* shift left */
-
-extern precision errorp(); /* user-substitutable error handler */
-
-extern precision pzero, pone, ptwo; /* constants 0, 1, and 2 */
-extern precision p_one; /* constant -1 */
-
-extern precision psqrt(); /* square root */
-extern precision pfactorial(); /* factorial */
-extern precision pipow(); /* unsigned int power */
-extern precision ppow(); /* precision power */
-extern precision ppowmod(); /* precision power mod m */
-extern int plogb(); /* log base b of n */
-
-extern precision dtop(); /* double to precision */
-extern double ptod(); /* precision to double */
-
-/*
- * vector operations
- */
-pvector pvundef(); /* local variable entry */
-void pvdestroy(); /* local variable exit */
-pvector pvalloc(); /* pvec allocate */
-void pvfree(); /* pvec free */
-pvector pvset(); /* set each element to scaler */
-
-#endif
diff --git a/src/benchmarks/cfrac/primes.c b/src/benchmarks/cfrac/primes.c
deleted file mode 100644
index f9dbd84..0000000
--- a/src/benchmarks/cfrac/primes.c
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
- * A table of all primes < 65536
- */
-unsigned int primesize = 6542;
-
-unsigned short primes[] = {
- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
- 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
- 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
- 127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
- 179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
- 233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
- 283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
- 353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
- 419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
- 467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
- 547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
- 607, 613, 617, 619, 631, 641, 643, 647, 653, 659,
- 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
- 739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
- 811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
- 877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
- 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013,
- 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069,
- 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151,
- 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223,
- 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291,
- 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373,
- 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451,
- 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511,
- 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583,
- 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657,
- 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733,
- 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811,
- 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889,
- 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987,
- 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053,
- 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129,
- 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213,
- 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287,
- 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357,
- 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423,
- 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531,
- 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617,
- 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687,
- 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741,
- 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819,
- 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903,
- 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999,
- 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079,
- 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181,
- 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257,
- 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331,
- 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413,
- 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511,
- 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571,
- 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643,
- 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727,
- 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821,
- 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907,
- 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989,
- 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057,
- 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139,
- 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231,
- 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297,
- 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409,
- 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493,
- 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583,
- 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657,
- 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751,
- 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831,
- 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937,
- 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003,
- 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087,
- 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179,
- 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279,
- 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387,
- 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443,
- 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521,
- 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639,
- 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693,
- 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791,
- 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857,
- 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939,
- 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053,
- 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133,
- 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221,
- 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301,
- 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367,
- 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473,
- 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571,
- 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673,
- 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761,
- 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833,
- 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917,
- 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997,
- 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103,
- 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207,
- 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297,
- 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411,
- 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499,
- 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561,
- 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643,
- 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723,
- 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829,
- 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919,
- 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017,
- 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111,
- 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219,
- 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291,
- 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387,
- 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501,
- 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597,
- 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677,
- 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741,
- 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831,
- 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929,
- 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011,
- 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109,
- 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199,
- 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283,
- 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377,
- 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439,
- 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533,
- 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631,
- 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733,
- 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811,
- 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887,
- 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973, 10007,
- 10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099,
- 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163, 10169, 10177,
- 10181, 10193, 10211, 10223, 10243, 10247, 10253, 10259, 10267, 10271,
- 10273, 10289, 10301, 10303, 10313, 10321, 10331, 10333, 10337, 10343,
- 10357, 10369, 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459,
- 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567,
- 10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639, 10651, 10657,
- 10663, 10667, 10687, 10691, 10709, 10711, 10723, 10729, 10733, 10739,
- 10753, 10771, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859,
- 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10939, 10949,
- 10957, 10973, 10979, 10987, 10993, 11003, 11027, 11047, 11057, 11059,
- 11069, 11071, 11083, 11087, 11093, 11113, 11117, 11119, 11131, 11149,
- 11159, 11161, 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251,
- 11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317, 11321, 11329,
- 11351, 11353, 11369, 11383, 11393, 11399, 11411, 11423, 11437, 11443,
- 11447, 11467, 11471, 11483, 11489, 11491, 11497, 11503, 11519, 11527,
- 11549, 11551, 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657,
- 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731, 11743, 11777,
- 11779, 11783, 11789, 11801, 11807, 11813, 11821, 11827, 11831, 11833,
- 11839, 11863, 11867, 11887, 11897, 11903, 11909, 11923, 11927, 11933,
- 11939, 11941, 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011,
- 12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101, 12107, 12109,
- 12113, 12119, 12143, 12149, 12157, 12161, 12163, 12197, 12203, 12211,
- 12227, 12239, 12241, 12251, 12253, 12263, 12269, 12277, 12281, 12289,
- 12301, 12323, 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401,
- 12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473, 12479, 12487,
- 12491, 12497, 12503, 12511, 12517, 12527, 12539, 12541, 12547, 12553,
- 12569, 12577, 12583, 12589, 12601, 12611, 12613, 12619, 12637, 12641,
- 12647, 12653, 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739,
- 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821, 12823, 12829,
- 12841, 12853, 12889, 12893, 12899, 12907, 12911, 12917, 12919, 12923,
- 12941, 12953, 12959, 12967, 12973, 12979, 12983, 13001, 13003, 13007,
- 13009, 13033, 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109,
- 13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177, 13183, 13187,
- 13217, 13219, 13229, 13241, 13249, 13259, 13267, 13291, 13297, 13309,
- 13313, 13327, 13331, 13337, 13339, 13367, 13381, 13397, 13399, 13411,
- 13417, 13421, 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499,
- 13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597, 13613, 13619,
- 13627, 13633, 13649, 13669, 13679, 13681, 13687, 13691, 13693, 13697,
- 13709, 13711, 13721, 13723, 13729, 13751, 13757, 13759, 13763, 13781,
- 13789, 13799, 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879,
- 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933, 13963, 13967,
- 13997, 13999, 14009, 14011, 14029, 14033, 14051, 14057, 14071, 14081,
- 14083, 14087, 14107, 14143, 14149, 14153, 14159, 14173, 14177, 14197,
- 14207, 14221, 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323,
- 14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407, 14411, 14419,
- 14423, 14431, 14437, 14447, 14449, 14461, 14479, 14489, 14503, 14519,
- 14533, 14537, 14543, 14549, 14551, 14557, 14561, 14563, 14591, 14593,
- 14621, 14627, 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699,
- 14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753, 14759, 14767,
- 14771, 14779, 14783, 14797, 14813, 14821, 14827, 14831, 14843, 14851,
- 14867, 14869, 14879, 14887, 14891, 14897, 14923, 14929, 14939, 14947,
- 14951, 14957, 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073,
- 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137, 15139, 15149,
- 15161, 15173, 15187, 15193, 15199, 15217, 15227, 15233, 15241, 15259,
- 15263, 15269, 15271, 15277, 15287, 15289, 15299, 15307, 15313, 15319,
- 15329, 15331, 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401,
- 15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473, 15493, 15497,
- 15511, 15527, 15541, 15551, 15559, 15569, 15581, 15583, 15601, 15607,
- 15619, 15629, 15641, 15643, 15647, 15649, 15661, 15667, 15671, 15679,
- 15683, 15727, 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773,
- 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859, 15877, 15881,
- 15887, 15889, 15901, 15907, 15913, 15919, 15923, 15937, 15959, 15971,
- 15973, 15991, 16001, 16007, 16033, 16057, 16061, 16063, 16067, 16069,
- 16073, 16087, 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183,
- 16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249, 16253, 16267,
- 16273, 16301, 16319, 16333, 16339, 16349, 16361, 16363, 16369, 16381,
- 16411, 16417, 16421, 16427, 16433, 16447, 16451, 16453, 16477, 16481,
- 16487, 16493, 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603,
- 16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661, 16673, 16691,
- 16693, 16699, 16703, 16729, 16741, 16747, 16759, 16763, 16787, 16811,
- 16823, 16829, 16831, 16843, 16871, 16879, 16883, 16889, 16901, 16903,
- 16921, 16927, 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993,
- 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053, 17077, 17093,
- 17099, 17107, 17117, 17123, 17137, 17159, 17167, 17183, 17189, 17191,
- 17203, 17207, 17209, 17231, 17239, 17257, 17291, 17293, 17299, 17317,
- 17321, 17327, 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389,
- 17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467, 17471, 17477,
- 17483, 17489, 17491, 17497, 17509, 17519, 17539, 17551, 17569, 17573,
- 17579, 17581, 17597, 17599, 17609, 17623, 17627, 17657, 17659, 17669,
- 17681, 17683, 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783,
- 17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863, 17881, 17891,
- 17903, 17909, 17911, 17921, 17923, 17929, 17939, 17957, 17959, 17971,
- 17977, 17981, 17987, 17989, 18013, 18041, 18043, 18047, 18049, 18059,
- 18061, 18077, 18089, 18097, 18119, 18121, 18127, 18131, 18133, 18143,
- 18149, 18169, 18181, 18191, 18199, 18211, 18217, 18223, 18229, 18233,
- 18251, 18253, 18257, 18269, 18287, 18289, 18301, 18307, 18311, 18313,
- 18329, 18341, 18353, 18367, 18371, 18379, 18397, 18401, 18413, 18427,
- 18433, 18439, 18443, 18451, 18457, 18461, 18481, 18493, 18503, 18517,
- 18521, 18523, 18539, 18541, 18553, 18583, 18587, 18593, 18617, 18637,
- 18661, 18671, 18679, 18691, 18701, 18713, 18719, 18731, 18743, 18749,
- 18757, 18773, 18787, 18793, 18797, 18803, 18839, 18859, 18869, 18899,
- 18911, 18913, 18917, 18919, 18947, 18959, 18973, 18979, 19001, 19009,
- 19013, 19031, 19037, 19051, 19069, 19073, 19079, 19081, 19087, 19121,
- 19139, 19141, 19157, 19163, 19181, 19183, 19207, 19211, 19213, 19219,
- 19231, 19237, 19249, 19259, 19267, 19273, 19289, 19301, 19309, 19319,
- 19333, 19373, 19379, 19381, 19387, 19391, 19403, 19417, 19421, 19423,
- 19427, 19429, 19433, 19441, 19447, 19457, 19463, 19469, 19471, 19477,
- 19483, 19489, 19501, 19507, 19531, 19541, 19543, 19553, 19559, 19571,
- 19577, 19583, 19597, 19603, 19609, 19661, 19681, 19687, 19697, 19699,
- 19709, 19717, 19727, 19739, 19751, 19753, 19759, 19763, 19777, 19793,
- 19801, 19813, 19819, 19841, 19843, 19853, 19861, 19867, 19889, 19891,
- 19913, 19919, 19927, 19937, 19949, 19961, 19963, 19973, 19979, 19991,
- 19993, 19997, 20011, 20021, 20023, 20029, 20047, 20051, 20063, 20071,
- 20089, 20101, 20107, 20113, 20117, 20123, 20129, 20143, 20147, 20149,
- 20161, 20173, 20177, 20183, 20201, 20219, 20231, 20233, 20249, 20261,
- 20269, 20287, 20297, 20323, 20327, 20333, 20341, 20347, 20353, 20357,
- 20359, 20369, 20389, 20393, 20399, 20407, 20411, 20431, 20441, 20443,
- 20477, 20479, 20483, 20507, 20509, 20521, 20533, 20543, 20549, 20551,
- 20563, 20593, 20599, 20611, 20627, 20639, 20641, 20663, 20681, 20693,
- 20707, 20717, 20719, 20731, 20743, 20747, 20749, 20753, 20759, 20771,
- 20773, 20789, 20807, 20809, 20849, 20857, 20873, 20879, 20887, 20897,
- 20899, 20903, 20921, 20929, 20939, 20947, 20959, 20963, 20981, 20983,
- 21001, 21011, 21013, 21017, 21019, 21023, 21031, 21059, 21061, 21067,
- 21089, 21101, 21107, 21121, 21139, 21143, 21149, 21157, 21163, 21169,
- 21179, 21187, 21191, 21193, 21211, 21221, 21227, 21247, 21269, 21277,
- 21283, 21313, 21317, 21319, 21323, 21341, 21347, 21377, 21379, 21383,
- 21391, 21397, 21401, 21407, 21419, 21433, 21467, 21481, 21487, 21491,
- 21493, 21499, 21503, 21517, 21521, 21523, 21529, 21557, 21559, 21563,
- 21569, 21577, 21587, 21589, 21599, 21601, 21611, 21613, 21617, 21647,
- 21649, 21661, 21673, 21683, 21701, 21713, 21727, 21737, 21739, 21751,
- 21757, 21767, 21773, 21787, 21799, 21803, 21817, 21821, 21839, 21841,
- 21851, 21859, 21863, 21871, 21881, 21893, 21911, 21929, 21937, 21943,
- 21961, 21977, 21991, 21997, 22003, 22013, 22027, 22031, 22037, 22039,
- 22051, 22063, 22067, 22073, 22079, 22091, 22093, 22109, 22111, 22123,
- 22129, 22133, 22147, 22153, 22157, 22159, 22171, 22189, 22193, 22229,
- 22247, 22259, 22271, 22273, 22277, 22279, 22283, 22291, 22303, 22307,
- 22343, 22349, 22367, 22369, 22381, 22391, 22397, 22409, 22433, 22441,
- 22447, 22453, 22469, 22481, 22483, 22501, 22511, 22531, 22541, 22543,
- 22549, 22567, 22571, 22573, 22613, 22619, 22621, 22637, 22639, 22643,
- 22651, 22669, 22679, 22691, 22697, 22699, 22709, 22717, 22721, 22727,
- 22739, 22741, 22751, 22769, 22777, 22783, 22787, 22807, 22811, 22817,
- 22853, 22859, 22861, 22871, 22877, 22901, 22907, 22921, 22937, 22943,
- 22961, 22963, 22973, 22993, 23003, 23011, 23017, 23021, 23027, 23029,
- 23039, 23041, 23053, 23057, 23059, 23063, 23071, 23081, 23087, 23099,
- 23117, 23131, 23143, 23159, 23167, 23173, 23189, 23197, 23201, 23203,
- 23209, 23227, 23251, 23269, 23279, 23291, 23293, 23297, 23311, 23321,
- 23327, 23333, 23339, 23357, 23369, 23371, 23399, 23417, 23431, 23447,
- 23459, 23473, 23497, 23509, 23531, 23537, 23539, 23549, 23557, 23561,
- 23563, 23567, 23581, 23593, 23599, 23603, 23609, 23623, 23627, 23629,
- 23633, 23663, 23669, 23671, 23677, 23687, 23689, 23719, 23741, 23743,
- 23747, 23753, 23761, 23767, 23773, 23789, 23801, 23813, 23819, 23827,
- 23831, 23833, 23857, 23869, 23873, 23879, 23887, 23893, 23899, 23909,
- 23911, 23917, 23929, 23957, 23971, 23977, 23981, 23993, 24001, 24007,
- 24019, 24023, 24029, 24043, 24049, 24061, 24071, 24077, 24083, 24091,
- 24097, 24103, 24107, 24109, 24113, 24121, 24133, 24137, 24151, 24169,
- 24179, 24181, 24197, 24203, 24223, 24229, 24239, 24247, 24251, 24281,
- 24317, 24329, 24337, 24359, 24371, 24373, 24379, 24391, 24407, 24413,
- 24419, 24421, 24439, 24443, 24469, 24473, 24481, 24499, 24509, 24517,
- 24527, 24533, 24547, 24551, 24571, 24593, 24611, 24623, 24631, 24659,
- 24671, 24677, 24683, 24691, 24697, 24709, 24733, 24749, 24763, 24767,
- 24781, 24793, 24799, 24809, 24821, 24841, 24847, 24851, 24859, 24877,
- 24889, 24907, 24917, 24919, 24923, 24943, 24953, 24967, 24971, 24977,
- 24979, 24989, 25013, 25031, 25033, 25037, 25057, 25073, 25087, 25097,
- 25111, 25117, 25121, 25127, 25147, 25153, 25163, 25169, 25171, 25183,
- 25189, 25219, 25229, 25237, 25243, 25247, 25253, 25261, 25301, 25303,
- 25307, 25309, 25321, 25339, 25343, 25349, 25357, 25367, 25373, 25391,
- 25409, 25411, 25423, 25439, 25447, 25453, 25457, 25463, 25469, 25471,
- 25523, 25537, 25541, 25561, 25577, 25579, 25583, 25589, 25601, 25603,
- 25609, 25621, 25633, 25639, 25643, 25657, 25667, 25673, 25679, 25693,
- 25703, 25717, 25733, 25741, 25747, 25759, 25763, 25771, 25793, 25799,
- 25801, 25819, 25841, 25847, 25849, 25867, 25873, 25889, 25903, 25913,
- 25919, 25931, 25933, 25939, 25943, 25951, 25969, 25981, 25997, 25999,
- 26003, 26017, 26021, 26029, 26041, 26053, 26083, 26099, 26107, 26111,
- 26113, 26119, 26141, 26153, 26161, 26171, 26177, 26183, 26189, 26203,
- 26209, 26227, 26237, 26249, 26251, 26261, 26263, 26267, 26293, 26297,
- 26309, 26317, 26321, 26339, 26347, 26357, 26371, 26387, 26393, 26399,
- 26407, 26417, 26423, 26431, 26437, 26449, 26459, 26479, 26489, 26497,
- 26501, 26513, 26539, 26557, 26561, 26573, 26591, 26597, 26627, 26633,
- 26641, 26647, 26669, 26681, 26683, 26687, 26693, 26699, 26701, 26711,
- 26713, 26717, 26723, 26729, 26731, 26737, 26759, 26777, 26783, 26801,
- 26813, 26821, 26833, 26839, 26849, 26861, 26863, 26879, 26881, 26891,
- 26893, 26903, 26921, 26927, 26947, 26951, 26953, 26959, 26981, 26987,
- 26993, 27011, 27017, 27031, 27043, 27059, 27061, 27067, 27073, 27077,
- 27091, 27103, 27107, 27109, 27127, 27143, 27179, 27191, 27197, 27211,
- 27239, 27241, 27253, 27259, 27271, 27277, 27281, 27283, 27299, 27329,
- 27337, 27361, 27367, 27397, 27407, 27409, 27427, 27431, 27437, 27449,
- 27457, 27479, 27481, 27487, 27509, 27527, 27529, 27539, 27541, 27551,
- 27581, 27583, 27611, 27617, 27631, 27647, 27653, 27673, 27689, 27691,
- 27697, 27701, 27733, 27737, 27739, 27743, 27749, 27751, 27763, 27767,
- 27773, 27779, 27791, 27793, 27799, 27803, 27809, 27817, 27823, 27827,
- 27847, 27851, 27883, 27893, 27901, 27917, 27919, 27941, 27943, 27947,
- 27953, 27961, 27967, 27983, 27997, 28001, 28019, 28027, 28031, 28051,
- 28057, 28069, 28081, 28087, 28097, 28099, 28109, 28111, 28123, 28151,
- 28163, 28181, 28183, 28201, 28211, 28219, 28229, 28277, 28279, 28283,
- 28289, 28297, 28307, 28309, 28319, 28349, 28351, 28387, 28393, 28403,
- 28409, 28411, 28429, 28433, 28439, 28447, 28463, 28477, 28493, 28499,
- 28513, 28517, 28537, 28541, 28547, 28549, 28559, 28571, 28573, 28579,
- 28591, 28597, 28603, 28607, 28619, 28621, 28627, 28631, 28643, 28649,
- 28657, 28661, 28663, 28669, 28687, 28697, 28703, 28711, 28723, 28729,
- 28751, 28753, 28759, 28771, 28789, 28793, 28807, 28813, 28817, 28837,
- 28843, 28859, 28867, 28871, 28879, 28901, 28909, 28921, 28927, 28933,
- 28949, 28961, 28979, 29009, 29017, 29021, 29023, 29027, 29033, 29059,
- 29063, 29077, 29101, 29123, 29129, 29131, 29137, 29147, 29153, 29167,
- 29173, 29179, 29191, 29201, 29207, 29209, 29221, 29231, 29243, 29251,
- 29269, 29287, 29297, 29303, 29311, 29327, 29333, 29339, 29347, 29363,
- 29383, 29387, 29389, 29399, 29401, 29411, 29423, 29429, 29437, 29443,
- 29453, 29473, 29483, 29501, 29527, 29531, 29537, 29567, 29569, 29573,
- 29581, 29587, 29599, 29611, 29629, 29633, 29641, 29663, 29669, 29671,
- 29683, 29717, 29723, 29741, 29753, 29759, 29761, 29789, 29803, 29819,
- 29833, 29837, 29851, 29863, 29867, 29873, 29879, 29881, 29917, 29921,
- 29927, 29947, 29959, 29983, 29989, 30011, 30013, 30029, 30047, 30059,
- 30071, 30089, 30091, 30097, 30103, 30109, 30113, 30119, 30133, 30137,
- 30139, 30161, 30169, 30181, 30187, 30197, 30203, 30211, 30223, 30241,
- 30253, 30259, 30269, 30271, 30293, 30307, 30313, 30319, 30323, 30341,
- 30347, 30367, 30389, 30391, 30403, 30427, 30431, 30449, 30467, 30469,
- 30491, 30493, 30497, 30509, 30517, 30529, 30539, 30553, 30557, 30559,
- 30577, 30593, 30631, 30637, 30643, 30649, 30661, 30671, 30677, 30689,
- 30697, 30703, 30707, 30713, 30727, 30757, 30763, 30773, 30781, 30803,
- 30809, 30817, 30829, 30839, 30841, 30851, 30853, 30859, 30869, 30871,
- 30881, 30893, 30911, 30931, 30937, 30941, 30949, 30971, 30977, 30983,
- 31013, 31019, 31033, 31039, 31051, 31063, 31069, 31079, 31081, 31091,
- 31121, 31123, 31139, 31147, 31151, 31153, 31159, 31177, 31181, 31183,
- 31189, 31193, 31219, 31223, 31231, 31237, 31247, 31249, 31253, 31259,
- 31267, 31271, 31277, 31307, 31319, 31321, 31327, 31333, 31337, 31357,
- 31379, 31387, 31391, 31393, 31397, 31469, 31477, 31481, 31489, 31511,
- 31513, 31517, 31531, 31541, 31543, 31547, 31567, 31573, 31583, 31601,
- 31607, 31627, 31643, 31649, 31657, 31663, 31667, 31687, 31699, 31721,
- 31723, 31727, 31729, 31741, 31751, 31769, 31771, 31793, 31799, 31817,
- 31847, 31849, 31859, 31873, 31883, 31891, 31907, 31957, 31963, 31973,
- 31981, 31991, 32003, 32009, 32027, 32029, 32051, 32057, 32059, 32063,
- 32069, 32077, 32083, 32089, 32099, 32117, 32119, 32141, 32143, 32159,
- 32173, 32183, 32189, 32191, 32203, 32213, 32233, 32237, 32251, 32257,
- 32261, 32297, 32299, 32303, 32309, 32321, 32323, 32327, 32341, 32353,
- 32359, 32363, 32369, 32371, 32377, 32381, 32401, 32411, 32413, 32423,
- 32429, 32441, 32443, 32467, 32479, 32491, 32497, 32503, 32507, 32531,
- 32533, 32537, 32561, 32563, 32569, 32573, 32579, 32587, 32603, 32609,
- 32611, 32621, 32633, 32647, 32653, 32687, 32693, 32707, 32713, 32717,
- 32719, 32749, 32771, 32779, 32783, 32789, 32797, 32801, 32803, 32831,
- 32833, 32839, 32843, 32869, 32887, 32909, 32911, 32917, 32933, 32939,
- 32941, 32957, 32969, 32971, 32983, 32987, 32993, 32999, 33013, 33023,
- 33029, 33037, 33049, 33053, 33071, 33073, 33083, 33091, 33107, 33113,
- 33119, 33149, 33151, 33161, 33179, 33181, 33191, 33199, 33203, 33211,
- 33223, 33247, 33287, 33289, 33301, 33311, 33317, 33329, 33331, 33343,
- 33347, 33349, 33353, 33359, 33377, 33391, 33403, 33409, 33413, 33427,
- 33457, 33461, 33469, 33479, 33487, 33493, 33503, 33521, 33529, 33533,
- 33547, 33563, 33569, 33577, 33581, 33587, 33589, 33599, 33601, 33613,
- 33617, 33619, 33623, 33629, 33637, 33641, 33647, 33679, 33703, 33713,
- 33721, 33739, 33749, 33751, 33757, 33767, 33769, 33773, 33791, 33797,
- 33809, 33811, 33827, 33829, 33851, 33857, 33863, 33871, 33889, 33893,
- 33911, 33923, 33931, 33937, 33941, 33961, 33967, 33997, 34019, 34031,
- 34033, 34039, 34057, 34061, 34123, 34127, 34129, 34141, 34147, 34157,
- 34159, 34171, 34183, 34211, 34213, 34217, 34231, 34253, 34259, 34261,
- 34267, 34273, 34283, 34297, 34301, 34303, 34313, 34319, 34327, 34337,
- 34351, 34361, 34367, 34369, 34381, 34403, 34421, 34429, 34439, 34457,
- 34469, 34471, 34483, 34487, 34499, 34501, 34511, 34513, 34519, 34537,
- 34543, 34549, 34583, 34589, 34591, 34603, 34607, 34613, 34631, 34649,
- 34651, 34667, 34673, 34679, 34687, 34693, 34703, 34721, 34729, 34739,
- 34747, 34757, 34759, 34763, 34781, 34807, 34819, 34841, 34843, 34847,
- 34849, 34871, 34877, 34883, 34897, 34913, 34919, 34939, 34949, 34961,
- 34963, 34981, 35023, 35027, 35051, 35053, 35059, 35069, 35081, 35083,
- 35089, 35099, 35107, 35111, 35117, 35129, 35141, 35149, 35153, 35159,
- 35171, 35201, 35221, 35227, 35251, 35257, 35267, 35279, 35281, 35291,
- 35311, 35317, 35323, 35327, 35339, 35353, 35363, 35381, 35393, 35401,
- 35407, 35419, 35423, 35437, 35447, 35449, 35461, 35491, 35507, 35509,
- 35521, 35527, 35531, 35533, 35537, 35543, 35569, 35573, 35591, 35593,
- 35597, 35603, 35617, 35671, 35677, 35729, 35731, 35747, 35753, 35759,
- 35771, 35797, 35801, 35803, 35809, 35831, 35837, 35839, 35851, 35863,
- 35869, 35879, 35897, 35899, 35911, 35923, 35933, 35951, 35963, 35969,
- 35977, 35983, 35993, 35999, 36007, 36011, 36013, 36017, 36037, 36061,
- 36067, 36073, 36083, 36097, 36107, 36109, 36131, 36137, 36151, 36161,
- 36187, 36191, 36209, 36217, 36229, 36241, 36251, 36263, 36269, 36277,
- 36293, 36299, 36307, 36313, 36319, 36341, 36343, 36353, 36373, 36383,
- 36389, 36433, 36451, 36457, 36467, 36469, 36473, 36479, 36493, 36497,
- 36523, 36527, 36529, 36541, 36551, 36559, 36563, 36571, 36583, 36587,
- 36599, 36607, 36629, 36637, 36643, 36653, 36671, 36677, 36683, 36691,
- 36697, 36709, 36713, 36721, 36739, 36749, 36761, 36767, 36779, 36781,
- 36787, 36791, 36793, 36809, 36821, 36833, 36847, 36857, 36871, 36877,
- 36887, 36899, 36901, 36913, 36919, 36923, 36929, 36931, 36943, 36947,
- 36973, 36979, 36997, 37003, 37013, 37019, 37021, 37039, 37049, 37057,
- 37061, 37087, 37097, 37117, 37123, 37139, 37159, 37171, 37181, 37189,
- 37199, 37201, 37217, 37223, 37243, 37253, 37273, 37277, 37307, 37309,
- 37313, 37321, 37337, 37339, 37357, 37361, 37363, 37369, 37379, 37397,
- 37409, 37423, 37441, 37447, 37463, 37483, 37489, 37493, 37501, 37507,
- 37511, 37517, 37529, 37537, 37547, 37549, 37561, 37567, 37571, 37573,
- 37579, 37589, 37591, 37607, 37619, 37633, 37643, 37649, 37657, 37663,
- 37691, 37693, 37699, 37717, 37747, 37781, 37783, 37799, 37811, 37813,
- 37831, 37847, 37853, 37861, 37871, 37879, 37889, 37897, 37907, 37951,
- 37957, 37963, 37967, 37987, 37991, 37993, 37997, 38011, 38039, 38047,
- 38053, 38069, 38083, 38113, 38119, 38149, 38153, 38167, 38177, 38183,
- 38189, 38197, 38201, 38219, 38231, 38237, 38239, 38261, 38273, 38281,
- 38287, 38299, 38303, 38317, 38321, 38327, 38329, 38333, 38351, 38371,
- 38377, 38393, 38431, 38447, 38449, 38453, 38459, 38461, 38501, 38543,
- 38557, 38561, 38567, 38569, 38593, 38603, 38609, 38611, 38629, 38639,
- 38651, 38653, 38669, 38671, 38677, 38693, 38699, 38707, 38711, 38713,
- 38723, 38729, 38737, 38747, 38749, 38767, 38783, 38791, 38803, 38821,
- 38833, 38839, 38851, 38861, 38867, 38873, 38891, 38903, 38917, 38921,
- 38923, 38933, 38953, 38959, 38971, 38977, 38993, 39019, 39023, 39041,
- 39043, 39047, 39079, 39089, 39097, 39103, 39107, 39113, 39119, 39133,
- 39139, 39157, 39161, 39163, 39181, 39191, 39199, 39209, 39217, 39227,
- 39229, 39233, 39239, 39241, 39251, 39293, 39301, 39313, 39317, 39323,
- 39341, 39343, 39359, 39367, 39371, 39373, 39383, 39397, 39409, 39419,
- 39439, 39443, 39451, 39461, 39499, 39503, 39509, 39511, 39521, 39541,
- 39551, 39563, 39569, 39581, 39607, 39619, 39623, 39631, 39659, 39667,
- 39671, 39679, 39703, 39709, 39719, 39727, 39733, 39749, 39761, 39769,
- 39779, 39791, 39799, 39821, 39827, 39829, 39839, 39841, 39847, 39857,
- 39863, 39869, 39877, 39883, 39887, 39901, 39929, 39937, 39953, 39971,
- 39979, 39983, 39989, 40009, 40013, 40031, 40037, 40039, 40063, 40087,
- 40093, 40099, 40111, 40123, 40127, 40129, 40151, 40153, 40163, 40169,
- 40177, 40189, 40193, 40213, 40231, 40237, 40241, 40253, 40277, 40283,
- 40289, 40343, 40351, 40357, 40361, 40387, 40423, 40427, 40429, 40433,
- 40459, 40471, 40483, 40487, 40493, 40499, 40507, 40519, 40529, 40531,
- 40543, 40559, 40577, 40583, 40591, 40597, 40609, 40627, 40637, 40639,
- 40693, 40697, 40699, 40709, 40739, 40751, 40759, 40763, 40771, 40787,
- 40801, 40813, 40819, 40823, 40829, 40841, 40847, 40849, 40853, 40867,
- 40879, 40883, 40897, 40903, 40927, 40933, 40939, 40949, 40961, 40973,
- 40993, 41011, 41017, 41023, 41039, 41047, 41051, 41057, 41077, 41081,
- 41113, 41117, 41131, 41141, 41143, 41149, 41161, 41177, 41179, 41183,
- 41189, 41201, 41203, 41213, 41221, 41227, 41231, 41233, 41243, 41257,
- 41263, 41269, 41281, 41299, 41333, 41341, 41351, 41357, 41381, 41387,
- 41389, 41399, 41411, 41413, 41443, 41453, 41467, 41479, 41491, 41507,
- 41513, 41519, 41521, 41539, 41543, 41549, 41579, 41593, 41597, 41603,
- 41609, 41611, 41617, 41621, 41627, 41641, 41647, 41651, 41659, 41669,
- 41681, 41687, 41719, 41729, 41737, 41759, 41761, 41771, 41777, 41801,
- 41809, 41813, 41843, 41849, 41851, 41863, 41879, 41887, 41893, 41897,
- 41903, 41911, 41927, 41941, 41947, 41953, 41957, 41959, 41969, 41981,
- 41983, 41999, 42013, 42017, 42019, 42023, 42043, 42061, 42071, 42073,
- 42083, 42089, 42101, 42131, 42139, 42157, 42169, 42179, 42181, 42187,
- 42193, 42197, 42209, 42221, 42223, 42227, 42239, 42257, 42281, 42283,
- 42293, 42299, 42307, 42323, 42331, 42337, 42349, 42359, 42373, 42379,
- 42391, 42397, 42403, 42407, 42409, 42433, 42437, 42443, 42451, 42457,
- 42461, 42463, 42467, 42473, 42487, 42491, 42499, 42509, 42533, 42557,
- 42569, 42571, 42577, 42589, 42611, 42641, 42643, 42649, 42667, 42677,
- 42683, 42689, 42697, 42701, 42703, 42709, 42719, 42727, 42737, 42743,
- 42751, 42767, 42773, 42787, 42793, 42797, 42821, 42829, 42839, 42841,
- 42853, 42859, 42863, 42899, 42901, 42923, 42929, 42937, 42943, 42953,
- 42961, 42967, 42979, 42989, 43003, 43013, 43019, 43037, 43049, 43051,
- 43063, 43067, 43093, 43103, 43117, 43133, 43151, 43159, 43177, 43189,
- 43201, 43207, 43223, 43237, 43261, 43271, 43283, 43291, 43313, 43319,
- 43321, 43331, 43391, 43397, 43399, 43403, 43411, 43427, 43441, 43451,
- 43457, 43481, 43487, 43499, 43517, 43541, 43543, 43573, 43577, 43579,
- 43591, 43597, 43607, 43609, 43613, 43627, 43633, 43649, 43651, 43661,
- 43669, 43691, 43711, 43717, 43721, 43753, 43759, 43777, 43781, 43783,
- 43787, 43789, 43793, 43801, 43853, 43867, 43889, 43891, 43913, 43933,
- 43943, 43951, 43961, 43963, 43969, 43973, 43987, 43991, 43997, 44017,
- 44021, 44027, 44029, 44041, 44053, 44059, 44071, 44087, 44089, 44101,
- 44111, 44119, 44123, 44129, 44131, 44159, 44171, 44179, 44189, 44201,
- 44203, 44207, 44221, 44249, 44257, 44263, 44267, 44269, 44273, 44279,
- 44281, 44293, 44351, 44357, 44371, 44381, 44383, 44389, 44417, 44449,
- 44453, 44483, 44491, 44497, 44501, 44507, 44519, 44531, 44533, 44537,
- 44543, 44549, 44563, 44579, 44587, 44617, 44621, 44623, 44633, 44641,
- 44647, 44651, 44657, 44683, 44687, 44699, 44701, 44711, 44729, 44741,
- 44753, 44771, 44773, 44777, 44789, 44797, 44809, 44819, 44839, 44843,
- 44851, 44867, 44879, 44887, 44893, 44909, 44917, 44927, 44939, 44953,
- 44959, 44963, 44971, 44983, 44987, 45007, 45013, 45053, 45061, 45077,
- 45083, 45119, 45121, 45127, 45131, 45137, 45139, 45161, 45179, 45181,
- 45191, 45197, 45233, 45247, 45259, 45263, 45281, 45289, 45293, 45307,
- 45317, 45319, 45329, 45337, 45341, 45343, 45361, 45377, 45389, 45403,
- 45413, 45427, 45433, 45439, 45481, 45491, 45497, 45503, 45523, 45533,
- 45541, 45553, 45557, 45569, 45587, 45589, 45599, 45613, 45631, 45641,
- 45659, 45667, 45673, 45677, 45691, 45697, 45707, 45737, 45751, 45757,
- 45763, 45767, 45779, 45817, 45821, 45823, 45827, 45833, 45841, 45853,
- 45863, 45869, 45887, 45893, 45943, 45949, 45953, 45959, 45971, 45979,
- 45989, 46021, 46027, 46049, 46051, 46061, 46073, 46091, 46093, 46099,
- 46103, 46133, 46141, 46147, 46153, 46171, 46181, 46183, 46187, 46199,
- 46219, 46229, 46237, 46261, 46271, 46273, 46279, 46301, 46307, 46309,
- 46327, 46337, 46349, 46351, 46381, 46399, 46411, 46439, 46441, 46447,
- 46451, 46457, 46471, 46477, 46489, 46499, 46507, 46511, 46523, 46549,
- 46559, 46567, 46573, 46589, 46591, 46601, 46619, 46633, 46639, 46643,
- 46649, 46663, 46679, 46681, 46687, 46691, 46703, 46723, 46727, 46747,
- 46751, 46757, 46769, 46771, 46807, 46811, 46817, 46819, 46829, 46831,
- 46853, 46861, 46867, 46877, 46889, 46901, 46919, 46933, 46957, 46993,
- 46997, 47017, 47041, 47051, 47057, 47059, 47087, 47093, 47111, 47119,
- 47123, 47129, 47137, 47143, 47147, 47149, 47161, 47189, 47207, 47221,
- 47237, 47251, 47269, 47279, 47287, 47293, 47297, 47303, 47309, 47317,
- 47339, 47351, 47353, 47363, 47381, 47387, 47389, 47407, 47417, 47419,
- 47431, 47441, 47459, 47491, 47497, 47501, 47507, 47513, 47521, 47527,
- 47533, 47543, 47563, 47569, 47581, 47591, 47599, 47609, 47623, 47629,
- 47639, 47653, 47657, 47659, 47681, 47699, 47701, 47711, 47713, 47717,
- 47737, 47741, 47743, 47777, 47779, 47791, 47797, 47807, 47809, 47819,
- 47837, 47843, 47857, 47869, 47881, 47903, 47911, 47917, 47933, 47939,
- 47947, 47951, 47963, 47969, 47977, 47981, 48017, 48023, 48029, 48049,
- 48073, 48079, 48091, 48109, 48119, 48121, 48131, 48157, 48163, 48179,
- 48187, 48193, 48197, 48221, 48239, 48247, 48259, 48271, 48281, 48299,
- 48311, 48313, 48337, 48341, 48353, 48371, 48383, 48397, 48407, 48409,
- 48413, 48437, 48449, 48463, 48473, 48479, 48481, 48487, 48491, 48497,
- 48523, 48527, 48533, 48539, 48541, 48563, 48571, 48589, 48593, 48611,
- 48619, 48623, 48647, 48649, 48661, 48673, 48677, 48679, 48731, 48733,
- 48751, 48757, 48761, 48767, 48779, 48781, 48787, 48799, 48809, 48817,
- 48821, 48823, 48847, 48857, 48859, 48869, 48871, 48883, 48889, 48907,
- 48947, 48953, 48973, 48989, 48991, 49003, 49009, 49019, 49031, 49033,
- 49037, 49043, 49057, 49069, 49081, 49103, 49109, 49117, 49121, 49123,
- 49139, 49157, 49169, 49171, 49177, 49193, 49199, 49201, 49207, 49211,
- 49223, 49253, 49261, 49277, 49279, 49297, 49307, 49331, 49333, 49339,
- 49363, 49367, 49369, 49391, 49393, 49409, 49411, 49417, 49429, 49433,
- 49451, 49459, 49463, 49477, 49481, 49499, 49523, 49529, 49531, 49537,
- 49547, 49549, 49559, 49597, 49603, 49613, 49627, 49633, 49639, 49663,
- 49667, 49669, 49681, 49697, 49711, 49727, 49739, 49741, 49747, 49757,
- 49783, 49787, 49789, 49801, 49807, 49811, 49823, 49831, 49843, 49853,
- 49871, 49877, 49891, 49919, 49921, 49927, 49937, 49939, 49943, 49957,
- 49991, 49993, 49999, 50021, 50023, 50033, 50047, 50051, 50053, 50069,
- 50077, 50087, 50093, 50101, 50111, 50119, 50123, 50129, 50131, 50147,
- 50153, 50159, 50177, 50207, 50221, 50227, 50231, 50261, 50263, 50273,
- 50287, 50291, 50311, 50321, 50329, 50333, 50341, 50359, 50363, 50377,
- 50383, 50387, 50411, 50417, 50423, 50441, 50459, 50461, 50497, 50503,
- 50513, 50527, 50539, 50543, 50549, 50551, 50581, 50587, 50591, 50593,
- 50599, 50627, 50647, 50651, 50671, 50683, 50707, 50723, 50741, 50753,
- 50767, 50773, 50777, 50789, 50821, 50833, 50839, 50849, 50857, 50867,
- 50873, 50891, 50893, 50909, 50923, 50929, 50951, 50957, 50969, 50971,
- 50989, 50993, 51001, 51031, 51043, 51047, 51059, 51061, 51071, 51109,
- 51131, 51133, 51137, 51151, 51157, 51169, 51193, 51197, 51199, 51203,
- 51217, 51229, 51239, 51241, 51257, 51263, 51283, 51287, 51307, 51329,
- 51341, 51343, 51347, 51349, 51361, 51383, 51407, 51413, 51419, 51421,
- 51427, 51431, 51437, 51439, 51449, 51461, 51473, 51479, 51481, 51487,
- 51503, 51511, 51517, 51521, 51539, 51551, 51563, 51577, 51581, 51593,
- 51599, 51607, 51613, 51631, 51637, 51647, 51659, 51673, 51679, 51683,
- 51691, 51713, 51719, 51721, 51749, 51767, 51769, 51787, 51797, 51803,
- 51817, 51827, 51829, 51839, 51853, 51859, 51869, 51871, 51893, 51899,
- 51907, 51913, 51929, 51941, 51949, 51971, 51973, 51977, 51991, 52009,
- 52021, 52027, 52051, 52057, 52067, 52069, 52081, 52103, 52121, 52127,
- 52147, 52153, 52163, 52177, 52181, 52183, 52189, 52201, 52223, 52237,
- 52249, 52253, 52259, 52267, 52289, 52291, 52301, 52313, 52321, 52361,
- 52363, 52369, 52379, 52387, 52391, 52433, 52453, 52457, 52489, 52501,
- 52511, 52517, 52529, 52541, 52543, 52553, 52561, 52567, 52571, 52579,
- 52583, 52609, 52627, 52631, 52639, 52667, 52673, 52691, 52697, 52709,
- 52711, 52721, 52727, 52733, 52747, 52757, 52769, 52783, 52807, 52813,
- 52817, 52837, 52859, 52861, 52879, 52883, 52889, 52901, 52903, 52919,
- 52937, 52951, 52957, 52963, 52967, 52973, 52981, 52999, 53003, 53017,
- 53047, 53051, 53069, 53077, 53087, 53089, 53093, 53101, 53113, 53117,
- 53129, 53147, 53149, 53161, 53171, 53173, 53189, 53197, 53201, 53231,
- 53233, 53239, 53267, 53269, 53279, 53281, 53299, 53309, 53323, 53327,
- 53353, 53359, 53377, 53381, 53401, 53407, 53411, 53419, 53437, 53441,
- 53453, 53479, 53503, 53507, 53527, 53549, 53551, 53569, 53591, 53593,
- 53597, 53609, 53611, 53617, 53623, 53629, 53633, 53639, 53653, 53657,
- 53681, 53693, 53699, 53717, 53719, 53731, 53759, 53773, 53777, 53783,
- 53791, 53813, 53819, 53831, 53849, 53857, 53861, 53881, 53887, 53891,
- 53897, 53899, 53917, 53923, 53927, 53939, 53951, 53959, 53987, 53993,
- 54001, 54011, 54013, 54037, 54049, 54059, 54083, 54091, 54101, 54121,
- 54133, 54139, 54151, 54163, 54167, 54181, 54193, 54217, 54251, 54269,
- 54277, 54287, 54293, 54311, 54319, 54323, 54331, 54347, 54361, 54367,
- 54371, 54377, 54401, 54403, 54409, 54413, 54419, 54421, 54437, 54443,
- 54449, 54469, 54493, 54497, 54499, 54503, 54517, 54521, 54539, 54541,
- 54547, 54559, 54563, 54577, 54581, 54583, 54601, 54617, 54623, 54629,
- 54631, 54647, 54667, 54673, 54679, 54709, 54713, 54721, 54727, 54751,
- 54767, 54773, 54779, 54787, 54799, 54829, 54833, 54851, 54869, 54877,
- 54881, 54907, 54917, 54919, 54941, 54949, 54959, 54973, 54979, 54983,
- 55001, 55009, 55021, 55049, 55051, 55057, 55061, 55073, 55079, 55103,
- 55109, 55117, 55127, 55147, 55163, 55171, 55201, 55207, 55213, 55217,
- 55219, 55229, 55243, 55249, 55259, 55291, 55313, 55331, 55333, 55337,
- 55339, 55343, 55351, 55373, 55381, 55399, 55411, 55439, 55441, 55457,
- 55469, 55487, 55501, 55511, 55529, 55541, 55547, 55579, 55589, 55603,
- 55609, 55619, 55621, 55631, 55633, 55639, 55661, 55663, 55667, 55673,
- 55681, 55691, 55697, 55711, 55717, 55721, 55733, 55763, 55787, 55793,
- 55799, 55807, 55813, 55817, 55819, 55823, 55829, 55837, 55843, 55849,
- 55871, 55889, 55897, 55901, 55903, 55921, 55927, 55931, 55933, 55949,
- 55967, 55987, 55997, 56003, 56009, 56039, 56041, 56053, 56081, 56087,
- 56093, 56099, 56101, 56113, 56123, 56131, 56149, 56167, 56171, 56179,
- 56197, 56207, 56209, 56237, 56239, 56249, 56263, 56267, 56269, 56299,
- 56311, 56333, 56359, 56369, 56377, 56383, 56393, 56401, 56417, 56431,
- 56437, 56443, 56453, 56467, 56473, 56477, 56479, 56489, 56501, 56503,
- 56509, 56519, 56527, 56531, 56533, 56543, 56569, 56591, 56597, 56599,
- 56611, 56629, 56633, 56659, 56663, 56671, 56681, 56687, 56701, 56711,
- 56713, 56731, 56737, 56747, 56767, 56773, 56779, 56783, 56807, 56809,
- 56813, 56821, 56827, 56843, 56857, 56873, 56891, 56893, 56897, 56909,
- 56911, 56921, 56923, 56929, 56941, 56951, 56957, 56963, 56983, 56989,
- 56993, 56999, 57037, 57041, 57047, 57059, 57073, 57077, 57089, 57097,
- 57107, 57119, 57131, 57139, 57143, 57149, 57163, 57173, 57179, 57191,
- 57193, 57203, 57221, 57223, 57241, 57251, 57259, 57269, 57271, 57283,
- 57287, 57301, 57329, 57331, 57347, 57349, 57367, 57373, 57383, 57389,
- 57397, 57413, 57427, 57457, 57467, 57487, 57493, 57503, 57527, 57529,
- 57557, 57559, 57571, 57587, 57593, 57601, 57637, 57641, 57649, 57653,
- 57667, 57679, 57689, 57697, 57709, 57713, 57719, 57727, 57731, 57737,
- 57751, 57773, 57781, 57787, 57791, 57793, 57803, 57809, 57829, 57839,
- 57847, 57853, 57859, 57881, 57899, 57901, 57917, 57923, 57943, 57947,
- 57973, 57977, 57991, 58013, 58027, 58031, 58043, 58049, 58057, 58061,
- 58067, 58073, 58099, 58109, 58111, 58129, 58147, 58151, 58153, 58169,
- 58171, 58189, 58193, 58199, 58207, 58211, 58217, 58229, 58231, 58237,
- 58243, 58271, 58309, 58313, 58321, 58337, 58363, 58367, 58369, 58379,
- 58391, 58393, 58403, 58411, 58417, 58427, 58439, 58441, 58451, 58453,
- 58477, 58481, 58511, 58537, 58543, 58549, 58567, 58573, 58579, 58601,
- 58603, 58613, 58631, 58657, 58661, 58679, 58687, 58693, 58699, 58711,
- 58727, 58733, 58741, 58757, 58763, 58771, 58787, 58789, 58831, 58889,
- 58897, 58901, 58907, 58909, 58913, 58921, 58937, 58943, 58963, 58967,
- 58979, 58991, 58997, 59009, 59011, 59021, 59023, 59029, 59051, 59053,
- 59063, 59069, 59077, 59083, 59093, 59107, 59113, 59119, 59123, 59141,
- 59149, 59159, 59167, 59183, 59197, 59207, 59209, 59219, 59221, 59233,
- 59239, 59243, 59263, 59273, 59281, 59333, 59341, 59351, 59357, 59359,
- 59369, 59377, 59387, 59393, 59399, 59407, 59417, 59419, 59441, 59443,
- 59447, 59453, 59467, 59471, 59473, 59497, 59509, 59513, 59539, 59557,
- 59561, 59567, 59581, 59611, 59617, 59621, 59627, 59629, 59651, 59659,
- 59663, 59669, 59671, 59693, 59699, 59707, 59723, 59729, 59743, 59747,
- 59753, 59771, 59779, 59791, 59797, 59809, 59833, 59863, 59879, 59887,
- 59921, 59929, 59951, 59957, 59971, 59981, 59999, 60013, 60017, 60029,
- 60037, 60041, 60077, 60083, 60089, 60091, 60101, 60103, 60107, 60127,
- 60133, 60139, 60149, 60161, 60167, 60169, 60209, 60217, 60223, 60251,
- 60257, 60259, 60271, 60289, 60293, 60317, 60331, 60337, 60343, 60353,
- 60373, 60383, 60397, 60413, 60427, 60443, 60449, 60457, 60493, 60497,
- 60509, 60521, 60527, 60539, 60589, 60601, 60607, 60611, 60617, 60623,
- 60631, 60637, 60647, 60649, 60659, 60661, 60679, 60689, 60703, 60719,
- 60727, 60733, 60737, 60757, 60761, 60763, 60773, 60779, 60793, 60811,
- 60821, 60859, 60869, 60887, 60889, 60899, 60901, 60913, 60917, 60919,
- 60923, 60937, 60943, 60953, 60961, 61001, 61007, 61027, 61031, 61043,
- 61051, 61057, 61091, 61099, 61121, 61129, 61141, 61151, 61153, 61169,
- 61211, 61223, 61231, 61253, 61261, 61283, 61291, 61297, 61331, 61333,
- 61339, 61343, 61357, 61363, 61379, 61381, 61403, 61409, 61417, 61441,
- 61463, 61469, 61471, 61483, 61487, 61493, 61507, 61511, 61519, 61543,
- 61547, 61553, 61559, 61561, 61583, 61603, 61609, 61613, 61627, 61631,
- 61637, 61643, 61651, 61657, 61667, 61673, 61681, 61687, 61703, 61717,
- 61723, 61729, 61751, 61757, 61781, 61813, 61819, 61837, 61843, 61861,
- 61871, 61879, 61909, 61927, 61933, 61949, 61961, 61967, 61979, 61981,
- 61987, 61991, 62003, 62011, 62017, 62039, 62047, 62053, 62057, 62071,
- 62081, 62099, 62119, 62129, 62131, 62137, 62141, 62143, 62171, 62189,
- 62191, 62201, 62207, 62213, 62219, 62233, 62273, 62297, 62299, 62303,
- 62311, 62323, 62327, 62347, 62351, 62383, 62401, 62417, 62423, 62459,
- 62467, 62473, 62477, 62483, 62497, 62501, 62507, 62533, 62539, 62549,
- 62563, 62581, 62591, 62597, 62603, 62617, 62627, 62633, 62639, 62653,
- 62659, 62683, 62687, 62701, 62723, 62731, 62743, 62753, 62761, 62773,
- 62791, 62801, 62819, 62827, 62851, 62861, 62869, 62873, 62897, 62903,
- 62921, 62927, 62929, 62939, 62969, 62971, 62981, 62983, 62987, 62989,
- 63029, 63031, 63059, 63067, 63073, 63079, 63097, 63103, 63113, 63127,
- 63131, 63149, 63179, 63197, 63199, 63211, 63241, 63247, 63277, 63281,
- 63299, 63311, 63313, 63317, 63331, 63337, 63347, 63353, 63361, 63367,
- 63377, 63389, 63391, 63397, 63409, 63419, 63421, 63439, 63443, 63463,
- 63467, 63473, 63487, 63493, 63499, 63521, 63527, 63533, 63541, 63559,
- 63577, 63587, 63589, 63599, 63601, 63607, 63611, 63617, 63629, 63647,
- 63649, 63659, 63667, 63671, 63689, 63691, 63697, 63703, 63709, 63719,
- 63727, 63737, 63743, 63761, 63773, 63781, 63793, 63799, 63803, 63809,
- 63823, 63839, 63841, 63853, 63857, 63863, 63901, 63907, 63913, 63929,
- 63949, 63977, 63997, 64007, 64013, 64019, 64033, 64037, 64063, 64067,
- 64081, 64091, 64109, 64123, 64151, 64153, 64157, 64171, 64187, 64189,
- 64217, 64223, 64231, 64237, 64271, 64279, 64283, 64301, 64303, 64319,
- 64327, 64333, 64373, 64381, 64399, 64403, 64433, 64439, 64451, 64453,
- 64483, 64489, 64499, 64513, 64553, 64567, 64577, 64579, 64591, 64601,
- 64609, 64613, 64621, 64627, 64633, 64661, 64663, 64667, 64679, 64693,
- 64709, 64717, 64747, 64763, 64781, 64783, 64793, 64811, 64817, 64849,
- 64853, 64871, 64877, 64879, 64891, 64901, 64919, 64921, 64927, 64937,
- 64951, 64969, 64997, 65003, 65011, 65027, 65029, 65033, 65053, 65063,
- 65071, 65089, 65099, 65101, 65111, 65119, 65123, 65129, 65141, 65147,
- 65167, 65171, 65173, 65179, 65183, 65203, 65213, 65239, 65257, 65267,
- 65269, 65287, 65293, 65309, 65323, 65327, 65353, 65357, 65371, 65381,
- 65393, 65407, 65413, 65419, 65423, 65437, 65447, 65449, 65479, 65497,
- 65519, 65521, 1
-};
diff --git a/src/benchmarks/cfrac/primes.h b/src/benchmarks/cfrac/primes.h
deleted file mode 100644
index 206f480..0000000
--- a/src/benchmarks/cfrac/primes.h
+++ /dev/null
@@ -1,2 +0,0 @@
-extern unsigned int primesize;
-extern unsigned short primes[];
diff --git a/src/benchmarks/cfrac/psqrt.c b/src/benchmarks/cfrac/psqrt.c
deleted file mode 100644
index 00531a6..0000000
--- a/src/benchmarks/cfrac/psqrt.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "precision.h"
-
-/*
- * Square root
- */
-precision psqrt(y)
- precision y;
-{
- int i;
- precision x = pUndef, lastx = pUndef;
-
- i = pcmpz(pparm(y));
- if (i == 0) { /* if y == 0 */
- pset(&lastx, pzero);
- } else if (i < 0) { /* if y negative */
- pset(&x, errorp(PDOMAIN, "psqrt", "negative argument"));
- } else {
- pset(&x, y);
- do {
- pset(&lastx, x);
- pset(&x, phalf(padd(x, pdiv(y, x))));
- } while (plt(x, lastx));
- }
-
- pdestroy(x);
-
- pdestroy(y);
- return presult(lastx);
-}
diff --git a/src/benchmarks/cfrac/psub.c b/src/benchmarks/cfrac/psub.c
deleted file mode 100644
index d887287..0000000
--- a/src/benchmarks/cfrac/psub.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-#include <string.h>
-
-#ifdef ASM_16BIT
-#include "asm16bit.h"
-#endif
-
-/*
- * Subtract u from v (assumes normalized)
- */
-precision psub(u, v)
-#ifndef ASM_16BIT
- precision u, v;
-{
- register digitPtr HiDigit, wPtr, uPtr;
- register digitPtr vPtr;
-#else
- register precision u, v;
-{
- register digitPtr wPtr, uPtr;
-#endif
- precision w;
- register accumulator temp;
-#ifndef ASM_16BIT
- register digit noborrow;
-#endif
- register int i;
-
- (void) pparm(u);
- (void) pparm(v);
- if (u->sign != v->sign) { /* Are we actually adding? */
- w = pUndef;
- v->sign = !v->sign; /* may generate -0 */
- pset(&w, padd(u, v));
- v->sign = !v->sign;
- } else {
- i = pcmp(u, v);
- if (u->sign) i = -i; /* compare magnitudes only */
-
- if (i < 0) {
- w = u; u = v; v = w; /* make u the largest */
- }
-
- w = palloc(u->size); /* may produce much wasted storage */
- if (w == pUndef) return w;
-
- if (i < 0) w->sign = !u->sign; else w->sign = u->sign;
-
- uPtr = u->value;
- wPtr = w->value;
-#ifndef ASM_16BIT
- vPtr = v->value;
- noborrow = 1;
-
- HiDigit = v->value + v->size; /* digits in both args */
- do {
- temp = (BASE-1) - *vPtr++; /* 0 <= temp < base */
- temp += *uPtr++; /* 0 <= temp < 2*base-1 */
- temp += noborrow; /* 0 <= temp < 2*base */
- noborrow = divBase(temp); /* 0 <= noborrow <= 1 */
- *wPtr++ = modBase(temp);
- } while (vPtr < HiDigit);
-
- HiDigit = u->value + u->size; /* propagate borrow */
- while (uPtr < HiDigit) {
- temp = (BASE-1) + *uPtr++;
- temp += noborrow; /* 0 <= temp < 2 * base */
- noborrow = divBase(temp); /* 0 <= noborrow <= 1 */
- *wPtr++ = modBase(temp);
- } /* noborrow = 1 */
-#else
- i = v->size;
- temp = u->size - i;
- if (temp > 0) {
- memcpy(wPtr + i, uPtr + i, temp * sizeof(digit));
- }
- if (memsubw(wPtr, uPtr, v->value, i)) { /* trashes uPtr */
- memdecw(wPtr + i, temp);
- }
- wPtr += w->size;
-#endif
- do { /* normalize */
- if (*--wPtr != 0) break;
- } while (wPtr > w->value);
- w->size = (wPtr - w->value) + 1;
- }
-
- pdestroy(u);
- pdestroy(v);
- return presult(w);
-}
diff --git a/src/benchmarks/cfrac/ptoa.c b/src/benchmarks/cfrac/ptoa.c
deleted file mode 100644
index a928ea2..0000000
--- a/src/benchmarks/cfrac/ptoa.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <string.h>
-#include "pdefs.h"
-#include "pcvt.h"
-#include "precision.h"
-
-/*
- * Return the character string decimal value of a Precision
- */
-#if (BASE > 10)
-#define CONDIGIT(d) ((d) < 10 ? (d) + '0' : (d) + 'a'-10)
-#else
-#define CONDIGIT(d) ((d) + '0')
-#endif
-
-char *ptoa(u)
- precision u;
-{
- register accumulator temp;
- register char *dPtr;
- char *d;
- int i = 0;
- unsigned int consize;
- precision r, v, pbase;
- register int j;
-
- (void) pparm(u);
- r = pUndef;
- v = pUndef;
- pbase = pUndef;
-
- consize = (unsigned int) u->size;
- if (consize > MAXINT / aDigits) {
- consize = (consize / pDigits) * aDigits;
- } else {
- consize = (consize * aDigits) / pDigits;
- }
-
- consize += aDigitLog + 2; /* leading 0's, sign, & '\0' */
- d = (char *) allocate((unsigned int) consize);
- if (d == (char *) 0) return d;
-
- pset(&v, pabs(u));
- pset(&pbase, utop(aDigit));
-
- dPtr = d + consize;
- *--dPtr = '\0'; /* null terminate string */
- i = u->sign; /* save sign */
- do {
- pdivmod(v, pbase, &v, &r);
- temp = ptou(r); /* Assumes unsigned and accumulator same! */
- j = aDigitLog;
- do {
- *--dPtr = CONDIGIT(temp % aBase); /* remainder */
- temp = temp / aBase;
- } while (--j > 0);
- } while (pnez(v));
-
- while (*dPtr == '0') dPtr++; /* toss leading zero's */
- if (*dPtr == '\0') --dPtr; /* but don't waste zero! */
- if (i) *--dPtr = '-';
- if (dPtr > d) { /* ASSUME copied from lower to higher! */
- (void) memcpy(d, dPtr, consize - (dPtr - d));
- }
-
- pdestroy(pbase);
- pdestroy(v);
- pdestroy(r);
-
- pdestroy(u);
- return d;
-}
diff --git a/src/benchmarks/cfrac/ptob.c b/src/benchmarks/cfrac/ptob.c
deleted file mode 100644
index d5b04c1..0000000
--- a/src/benchmarks/cfrac/ptob.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include "pdefs.h"
-#include "precision.h"
-
-/*
- * Convert a precision to a given base (the sign is ignored)
- *
- * Input:
- * u - the number to convert
- * dest - Where to put the ASCII representation radix
- * WARNING! Not '\0' terminated, this is an exact image
- * size - the number of digits of dest.
- * (alphabet[0] padded on left)
- * if size is too small, truncation occurs on left
- * alphabet - A mapping from each radix digit to it's character digit
- * (note: '\0' is perfectly OK as a digit)
- * radix - The size of the alphabet, and the conversion radix
- * 2 <= radix < 256.
- *
- * Returns:
- * -1 if invalid radix
- * 0 if successful
- * >0 the number didn't fit
- */
-int ptob(u, dest, size, alphabet, radix)
- precision u; /* the number to convert */
- char *dest; /* where to place the converted ascii */
- unsigned int size; /* the size of the result in characters */
- char *alphabet; /* the character set forming the radix */
- register unsigned int radix; /* the size of the character set */
-{
- register accumulator temp;
- register unsigned int i;
- register char *chp;
- unsigned int lgclump;
- int res = 0;
-
- precision r = pUndef, v = pUndef, pbase = pUndef;
-
- if (radix > 256 || radix < 2) return -1;
- if (size == 0) return 1;
-
- (void) pparm(u);
- temp = radix;
- i = 1;
- while (temp * radix > temp) {
- temp *= radix;
- i++;
- }
- lgclump = i;
-
- pset(&v, pabs(u));
- pset(&pbase, utop(temp)); /* assumes accumulator and int are the same! */
-
- chp = dest + size;
- do {
- pdivmod(v, pbase, &v, &r);
- temp = ptou(r); /* assumes accumulator and int are the same! */
- i = lgclump;
- do {
- *--chp = alphabet[temp % radix]; /* remainder */
- temp = temp / radix;
- if (chp == dest) goto bail;
- } while (--i > 0);
- } while pnez(v);
-
- if (chp > dest) do {
- *--chp = *alphabet;
- } while (chp > dest);
-
-bail:
- if (pnez(v) || temp != 0) { /* check for overflow */
- res = 1;
- }
-
- pdestroy(pbase);
- pdestroy(v);
- pdestroy(r);
-
- pdestroy(u);
- return res;
-}
diff --git a/src/benchmarks/cfrac/ptou.c b/src/benchmarks/cfrac/ptou.c
deleted file mode 100644
index b8ca07b..0000000
--- a/src/benchmarks/cfrac/ptou.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "pdefs.h"
-#include "pcvt.h"
-#include "precision.h"
-
-/*
- * Precision to unsigned
- */
-unsigned int ptou(u)
- precision u;
-{
- register digitPtr uPtr;
- register accumulator temp;
-
- (void) pparm(u);
- if (u->sign) {
- temp = (unsigned long) errorp(PDOMAIN, "ptou", "negative argument");
- } else {
- uPtr = u->value + u->size;
- temp = 0;
- do {
- if (temp > divBase(MAXUNSIGNED - *--uPtr)) {
- temp = (unsigned long) errorp(POVERFLOW, "ptou", "overflow");
- break;
- }
- temp = mulBase(temp);
- temp += *uPtr;
- } while (uPtr > u->value);
- }
- pdestroy(u);
- return (unsigned int) temp;
-}
diff --git a/src/benchmarks/cfrac/seive.h b/src/benchmarks/cfrac/seive.h
deleted file mode 100644
index 2e1cb85..0000000
--- a/src/benchmarks/cfrac/seive.h
+++ /dev/null
@@ -1,3 +0,0 @@
-extern unsigned long seivesize;
-
-extern unsigned char seive[];
diff --git a/src/benchmarks/cfrac/utop.c b/src/benchmarks/cfrac/utop.c
deleted file mode 100644
index 4d87c04..0000000
--- a/src/benchmarks/cfrac/utop.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "pdefs.h"
-#include "pcvt.h"
-#include "precision.h"
-
-/*
- * Unsigned to Precision
- */
-precision utop(i)
- register unsigned int i;
-{
- register digitPtr uPtr;
- register precision u = palloc(INTSIZE);
-
- if (u == pUndef) return pUndef;
-
- u->sign = false;
- uPtr = u->value;
- do {
- *uPtr++ = modBase(i);
- i = divBase(i);
- } while (i != 0);
-
- u->size = (uPtr - u->value);
- return presult(u);
-}