/* ** cordic -- program to calculate various functions ** (e.g. trigonometric) using CORDIC techniques ** ** original author unknown ** modified by Joseph B. Evans, 11/15/91 ** evans@shannon.tisl.ukans.edu */ #include "cordic.h" main(ac, av) int ac; char **av; { long x, y; long r, theta; long sine, cosine; if (ac == 2) { theta = (long)atof(av[1]); } else { printf("usage: %s theta\n",av[0]); exit(1); } theta *= (1<<(BITS-MSBITS)); fxunitvec(&sine,&cosine,theta); printf("sine = %g\n",sine/(double)(1<<(BITS-1))); printf("cosine = %g\n",cosine/(double)(1<<(BITS-1))); }