This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
_iq alpha = _IQsin(_IQ(2.0));
I expect that the answer of this should be sin(radians) = sin(2.0) = 0.90929
However, I am getting an answer of 0.134223938 (IQ24 converted to float) as I enter breakpoint into my debugging window.
Here are a few examples and outcomes:
_iq alpha = _IQsin(_IQ(1.0)); ---> gives a IQ24 output of -12772547 and a float converted output of -0.7613031864
_iq alpha = _IQsin(_IQ(3.0)); ---> gives a IQ24 output of 15223745 and a float converted output of 0.9074059129
_iq alpha = _IQsin(_IQ(3.14159)); ---> gives a IQ24 output of 16111031 and a float converted output of 0.9602923393
Also, _IQdiv(ANY VALUE) gives me 581117741 which is float 34.63731652
Please advice. No errors are found during project build.
A couple things you can check.
1. did you get any warnings about "implicit function defined" - it could be the project cannot find "IQMath.lib"
2. is GLOBAL_Q set to 24
3. Are the IQMathTables in the right location in the linker command file
4. can you use the IQ specific function, IQ24sin instead of IQsin - does that make a difference