Thread: Sin, Cos, Atan
View Single Post
  #3   Spotlight this post!  
Unread 16-02-2005, 02:10
the_undefined's Avatar
the_undefined the_undefined is offline
German FES
AKA: Felix Geisendörfer
#1648 (Gearbox Gangstas)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Germany
Posts: 77
the_undefined has a spectacular aura aboutthe_undefined has a spectacular aura about
Re: Sin, Cos, Atan

Quote:
Originally Posted by jgannon
There are 256 binary radians (also called "brads") to a circle, just as there are 360 degrees to a circle. With this, you should be able to figure out how to convert degrees to brads. Once you have the result from the 296 CORDIC library, I would drop the 8 least significant bits (answer>>=8) and then cast that as an integer. Good luck.
Thanks for your Help but I still have a little problem with that:

When I test it with my function:
Quote:
sin_test(0);
sin_test(127);
sin_test(255);

void sin_test(short long value)
{
short long result; // int p_result, int p_value;

result = sin((short long)value);

result>>=8;
value>>=8;

printf("Sin of %d = %d\n", (int)result, (int)result);
}
I always get 0's back (for value and for result). I tried result>>8 instead but that always gave me value for both (for value and for result) ...

what am I doing wrong?