#include <math.h>
#include <assert.h>
#include <stdio.h>
#include "cement.h"

/* Global Variables */
double powLookup[256];

/* Function declarations */
void initilizeLookup(double p);

int main(int argc, char ** argv)
{
    double p=EXPONENT;  /* exponent for pow */
    FILE *fp;
    int i;
    
    initilizeLookup(p);


    fp=fopen("powLookup.h","w");
    assert(fp!=NULL);


    fprintf(fp,"#ifndef __POW_LOOKUP_TABLE_H\n");
    fprintf(fp,"#define __POW_LOOKUP_TABLE_H\n");
    fprintf(fp,"static double powLookupExponent=%f;\n",p);
    fprintf(fp,"static double powLookupTable[256]={\n");
    
    for(i=0;i<255;i++)
        fprintf(fp,"%12.30f,\n",powLookup[i]);

    fprintf(fp,"%12.25f};\n",powLookup[i]);
    fprintf(fp,"#endif\n");

    fclose(fp);
    
    return(0);
}

void initilizeLookup(double p)
{
    int i;

    for(i=0;i<256;i++)
        powLookup[i]=pow((double)i,p);
}

