Hello,
I am reading the document of C28x IQmath Library ( sprc990c). However, on the page 65, there is one piece of sample code:
#include “IQmathLib.h”
#define PI 3.14156L
_iq xin1, yin1, out1;
_iq29 xin2, yin2, out2;
void main(void )
{
// xin1 = xin2 = cos(PI/5) x 2^29 = 0x19E37FA8
// yin1 = yin2 = sin(PI/5) x 2^29 = 0x12CF17EF
// out1 = out2 = PI/5 x 2^29 = 0x141B21C3
xin1 = _IQcos(_IQ(PI/5.0L));
yin1 = _IQsin(_IQ(PI/5.0L));
out1 = _IQatan2(yin1,xin1);
xin2 = _IQ29cos(_IQ29(PI/5.0L));
yin2 = _IQ29sin(_IQ29(PI/5.0L));
out2 = _IQ29atan2(yin1,xin1);
}
I noticed that xin1, yin1, out1 are defined as "_iq". but in the comments of the code, there is "// xin1 = xin2 = cos(PI/5) x 2^29 = 0x19E37FA8"
Where does this "2^29" come from? Why is this 2^29 here? What if I define "_iq xin2, yin2, out2"? Would there be 2^29 again in the example?
Thanks a lot!