I am using trigonometric functions of IQmath library. According to my observation _IQcos and _IQsin functions work correctly. But for _IQacos and _IQasin functions, I obtain unexpected results at the output. Here is the code I use:
_iq output1_iq;
_iq output2_iq;
_iq input1_iq;
_iq input2_iq;
output1_iq = _IQacos(input1_iq);
output2_iq = _IQasin(input2_iq);
I use IQ24 as global Q format. In the table given below, you can see the input values of _IQacos and _IQasin functions. Also you can see expected and obtained results at those functions.
| _IQacos | _IQasin | |||
| input | expected | obtained | expected | obtained |
| 0 | 1,5707963268 | 0,3140258789 | 0,0 | 1,2567704320 |
| 0,70710678 | 0,7853981634 | 0,2618502378 | 0,7853981634 | 1,3089460730 |
| 0,8660254 | 0,5235987756 | -1,1154794100 | 1,0471975512 | 2,6862757210 |
| 1 | 0,0 | 2,5135409830 | 1,5707963268 | -0,9427446723 |
| -0,707107 | 2,3561944902 | 2,8797424440 | -0,7853981634 | -1,3089461330 |
| -0,866025 | 2,6179938780 | -3,7429279090 | -1,0471975512 | -2,6862757800 |
| -1 | 3,1415926536 | 0,6280516982 | -1,5707963268 | 0,9427446127 |
What should be the reason of this problem? How can I overcome this problem?