source: abuse/trunk/src/calctrig.cpp @ 2

Last change on this file since 2 was 2, checked in by Sam Hocevar, 14 years ago
  • imported original 0.7.0 tarball
File size: 547 bytes
Line 
1#include <math.h>
2
3main()
4{
5  int i,x;
6  printf("long sin_table[360]={\n  ");
7  for (i=0;i<360;i++)
8  {
9    printf("0x%08x",(long)(sin(i/180.0*3.141592654)*65536));
10    if (i!=359) printf(", ");
11    if ((i%6)==5) printf("\n  ");
12  }
13  printf("};\n");
14
15  printf("unsigned short atan_table[1662]={\n  ");
16 
17  for (i=1;i<1662;i++)
18  {   
19    if (i<29) x=0;
20    else x=(long)(atan(i/(double)29)/3.14152654*180)-45;
21    if (x<0) x+=360;
22    printf("%3d",x);
23    if (i!=1661) printf(", ");
24    if ((i%12)==11) printf("\n  ");
25  }
26  printf("};\n"); 
27}
Note: See TracBrowser for help on using the repository browser.