Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: pimathbrainiac on December 02, 2013, 12:49:12 pm

Title: Request - sine and cosine functions that outputs an 8.8 fixed point number
Post by: pimathbrainiac on December 02, 2013, 12:49:12 pm
Well, I'm working on a secret project atm. In order to make this project work, I need both a sine and cosine function that outputs an 8.8 fixed point number from -1 - 1.

My attempt in pure axe is this:

(sin(theta)*256)//128.0->Sine Answer
and
(cos(theta)*256)//128.0->Cosine Answer

The problem is that it only will work for positive sine and cosine answers.

So: does anyone have the hex for a sine and a cosine function for angles 0-255 (as in 256 = 0) that will output an 8.8 fixed point answer to HL and a positive/negative (1=neg,0=pos) flag to where ever axe's r6 (argument 6) is stored.

Thanks in advance!
Title: Re: Request - sine and cosine functions that outputs an 8.8 fixed point number
Post by: Matrefeytontias on December 02, 2013, 12:53:28 pm
Hum, cos/sin already outputs fixed point ... it's just divided by 2.
Title: Re: Request - sine and cosine functions that outputs an 8.8 fixed point number
Post by: pimathbrainiac on December 02, 2013, 12:54:51 pm
Hum, cos/sin already outputs fixed point ... it's just divided by 2.

so wait, if I multiply by 2, I get an 8.8 ranging from -1 to 1?
Title: Re: Request - sine and cosine functions that outputs an 8.8 fixed point number
Post by: Streetwalrus on December 02, 2013, 12:57:09 pm
I guess so. ;)
Title: Re: Request - sine and cosine functions that outputs an 8.8 fixed point number
Post by: Matrefeytontias on December 02, 2013, 12:58:29 pm
Yes, but of course you'll lose one bit of precision. But I don't think that matters much.