source: S-port/trunk/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ControllerFunctions/sin_cos.c@ 1

Last change on this file since 1 was 1, checked in by AlexLir, 2 years ago
File size: 601 bytes
Line 
1#include "ref.h"
2
3void ref_sin_cos_f32(
4 float32_t theta,
5 float32_t * pSinVal,
6 float32_t * pCosVal)
7{
8 //theta is given in degrees
9 *pSinVal = sinf(theta * 6.28318530717959f / 360.0f);
10 *pCosVal = cosf(theta * 6.28318530717959f / 360.0f);
11}
12
13void ref_sin_cos_q31(
14 q31_t theta,
15 q31_t * pSinVal,
16 q31_t * pCosVal)
17{
18 //theta is given in the range [-1,1) to represent [-pi,pi)
19 *pSinVal = (q31_t)(sinf((float32_t)theta * 3.14159265358979f / 2147483648.0f) * 2147483648.0f);
20 *pCosVal = (q31_t)(cosf((float32_t)theta * 3.14159265358979f / 2147483648.0f) * 2147483648.0f);
21}
Note: See TracBrowser for help on using the repository browser.