is that cordic boiled down? or something else?x=radius;
y=0;
m=1/256 or other fraction which makes a small number.
do forever
{ x=x - y*m;
y=y + x*m;
}
will trace out an almost perfect circle.
Can be done with only adds and shifts if the denominator of the small fraction is a power of two...
From the Cordic algorithm.
long cosine(int ang)
{
int x,y;
long tmp,count=0;
if(ang > 900) ang = 900 -(ang - 900);
for(x=0;x<30;x++)
{
y += 2;
tmp = ReadTable(y);
if(ang == 30)
{
count += tmp;
count = 4000 - count;
return count;
}
if(ang < 30)
{
count += (tmp/30)* ang;
count = 4000 - count;
return count;
}
count += tmp;
ang -= 30;
}
return 0;
}