LIBML  Version 3.2.4
LIBML DSP Software Library
Functions
Collaboration diagram for Cosine:

Functions

f32_t tpt_cos_f32 (f32_t x)
 Fast approximation to the trigonometric cosine function for floating-point data. More...
 
f64_t tpt_cos_f64 (f64_t x)
 Fast approximation to the trigonometric cosine function for floating-point data. More...
 
q15_t tpt_cos_q15 (q15_t x)
 Fast approximation to the trigonometric cosine function for Q15 data. More...
 
q31_t tpt_cos_q31 (q31_t x)
 Fast approximation to the trigonometric cosine function for Q31 data. More...
 

Detailed Description

Use the look-up table to calculate the cosine value There are separate functions for Q15, Q31, and floating-point data types. The input to the floating-point version is in radians while the fixed-point Q15 and Q31 have a scaled input with the range [-1, 1) mapping to [-π, π). The fixed-point range is chosen so that a value of π wraps around to -π.

The implementation is based on table lookup using 4096 values.

Function Documentation

◆ tpt_cos_f32()

f32_t tpt_cos_f32 ( f32_t  x)

Fast approximation to the trigonometric cosine function for floating-point data.

Parameters
[in]xinput value in radians
Returns
cos(x)

◆ tpt_cos_f64()

f64_t tpt_cos_f64 ( f64_t  x)

Fast approximation to the trigonometric cosine function for floating-point data.

Parameters
[in]xinput value in radians
Returns
cos(x)

◆ tpt_cos_q15()

q15_t tpt_cos_q15 ( q15_t  x)

Fast approximation to the trigonometric cosine function for Q15 data.

Fast approximation to the trigonometric cosine function for Q15.

Parameters
[in]xScaled input value in radians
Returns
cos(x)

The Q15 input value is in the range [-1, 1) and is mapped to a radian value in the range [-π, π).

◆ tpt_cos_q31()

q31_t tpt_cos_q31 ( q31_t  x)

Fast approximation to the trigonometric cosine function for Q31 data.

Parameters
[in]xScaled input value in radians
Returns
cos(x)

The Q31 input value is in the range [-1, 1) and is mapped to a radian value in the range [-π, π).