/* File name: sqrttest.c
   13Apr2004 .. initial version .. KM
*/

#include <stdio.h>

#define NCPX 1

void rsquared64(long *, long *, unsigned short);
void sqrt64V1(long *, long *, unsigned short);

long r2[2*NCPX];
 
long r[]={0L, 1L, 4L, 5L, 63L, 64L, 65L, 127L, 128L, 129L,
          12334L, 0x7FFFFFFF}; 
 
void main(void)
{
    int idx, n;
    FILE *out;
    
    out = fopen("sqrttest.txt","w");
    if (out == NULL) {
    	printf("couldn't output file\n");
    	exit (1);
    }
    n = sizeof(r)/sizeof(long);
    for (idx = 0; idx<n; idx++) {
        r2[0] = r[idx];
        r2[1] = 0L;
        rsquared64(r2, r2, 1);
        sqrt64V1(r2, r2, 1);    
        printf("%11ld %11ld %11ld \n", r[idx], r2[0], r[idx]-r2[0]);
        fprintf(out, "%11ld %11ld %11ld \n", r[idx], r2[0], r[idx]-r2[0]);
    }
    fclose(out);
}
