rendered paste body#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include "defs.h"
#include "externs.h"
#include "proto.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
F R E Q U E N C Y T E S T
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int main ()
{
return 0;
}
void Frequency(int n)
{
int i, state;
double f, s_obs, p_value, sum;
double sqrt2 = 1.41421356237309504880;
char assignment[7];
#ifdef GEN_TIMING_INFO
clock_t start, finish;
FILE *fp;
fp = fopen("Frequency.txt", "a");
start = clock();
#endif
sum = 0.0;
for( i=0; i<n; i++ )
sum += 2*(int)epsilon[i].b-1;
s_obs = fabs(sum)/sqrt(n);
f = s_obs/sqrt2;
p_value = erfc(f);
if ( FREQUENCY ) {
fprintf(stats[1], "\t\t\t FREQUENCY TEST\n");
fprintf(stats[1], "\t\t---------------------------------------------\n");
fprintf(stats[1], "\t\tCOMPUTATIONAL INFORMATION:\n");
fprintf(stats[1], "\t\t---------------------------------------------\n");
fprintf(stats[1], "\t\t(a) The nth partial sum = %d\n", (int)sum);
fprintf(stats[1], "\t\t(b) S_n/n = %f\n", sum/n);
fprintf(stats[1], "\t\t---------------------------------------------\n");
}
if ( p_value < ALPHA ) { /* INTERPRETATION */
strcpy(assignment,"FAILURE");
state = 0;
}
else {
strcpy(assignment,"SUCCESS");
state = 1;
}
fprintf(stats[1], "%s\t\tp_value = %f\n\n", assignment, p_value);
fprintf(results[1], "%f\n", p_value);
fprintf(grid, "%d", state);
fflush(stats[1]);
fflush(results[1]);
fflush(grid);
#ifdef GEN_TIMING_INFO
finish = clock();
fprintf(fp, "%d\n", finish - start);
fclose(fp);
#endif
return;
}