cosFix16 inaccuracy

SGDK only sub forum

Moderator: Stef

Post Reply
kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

cosFix16 inaccuracy

Post by kubilus1 » Sun Nov 09, 2014 4:09 pm

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?

Chilly Willy
Very interested
Posts: 2854
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Nov 09, 2014 7:33 pm

The input is NOT degrees, it's 2pi / 1024. So 180 would be 512, not 180. That's in the include file (math.h).

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Post by kubilus1 » Sun Nov 09, 2014 10:31 pm

Doh, of course! It pays to read the descriptions, I must have glossed right over it.

Post Reply