#include	<stdio.h>
#include	<math.h>

#define		PAI	3.141592654

FILE		*fpw0;

void main()
{
	double	i,b;
	short	a,j;

	j = 7;

	/****** write file open ******/
	if((fpw0=fopen("cos.dat","w")) == 0){
		printf("can't open !!\n");
		exit(1);
	}

	/****** cos data label set ******/
	fprintf(fpw0,"/************************************************************************/\n");
	fprintf(fpw0,"/*        ＣＯＳデータ　（１００ｈ＝１．０）                            */\n");
	fprintf(fpw0,"/************************************************************************/\n");

	/****** atan data make ******/
	fprintf(fpw0,"short\tcos_table[] = {\n\t\t      ");
	for(i = 0; i <= 0x100; i++){
		b = cos(i/0x100);
		b = (b >= 0 ? b+.5: b-.5);

		a = (unsigned short)b;
		if(j--==0){
			j=7;
			fprintf(fpw0,",\n\t\t%5d",a);
		}
		else{
			fprintf(fpw0,",%5d",a);
		}
	}
	fprintf(fpw0,"\n};\n");

	/****** write file close ******/
	fclose(fpw0);
}