Page 1 of 1

cosFix16 inaccuracy

Posted: Sun Nov 09, 2014 4:09 pm
by kubilus1
So I seem to get very inaccurate results using the SGDK cos/sin tables. For instance this is what I see:

regular C function:
cos(180) = -0.593

SGDK function:
cosFix16(180) = 0.453

What's the deal with the different values?

Posted: Sun Nov 09, 2014 7:33 pm
by Chilly Willy
The input is NOT degrees, it's 2pi / 1024. So 180 would be 512, not 180. That's in the include file (math.h).

Posted: Sun Nov 09, 2014 10:31 pm
by kubilus1
Doh, of course! It pays to read the descriptions, I must have glossed right over it.