CosineFast Math Functions
|float32_t||arm_cos_f32 (float32_t x)|
|Fast approximation to the trigonometric cosine function for floating-point data. |
|q15_t||arm_cos_q15 (q15_t x)|
|Fast approximation to the trigonometric cosine function for Q15 data. |
|q31_t||arm_cos_q31 (q31_t x)|
|Fast approximation to the trigonometric cosine function for Q31 data. |
Computes the trigonometric cosine function using a combination of table lookup and linear interpolation. There are separate functions for Q15, Q31, and floating-point data types. The input to the floating-point version is in radians and in the range [0 2*pi) while the fixed-point Q15 and Q31 have a scaled input with the range [0 +0.9999] mapping to [0 2*pi). The fixed-point range is chosen so that a value of 2*pi wraps around to 0.
The implementation is based on table lookup using 256 values together with linear interpolation. The steps used are:
- Calculation of the nearest integer table index
- Compute the fractional portion (fract) of the table index.
- The final result equals
(1.0f-fract)*a + fract*b;