1.4.3.1 _LIBQ_Q15_cos_Q2_13 Function

Calculates the value of cosine(x).

Description

_Q15 _LIBQ_Q15_cos_Q2_13 (_Q2_13 x);

Calculates the cosine(x), where x is of type _Q2_13 radians and the resulting value is of type _Q15.

Preconditions

None

Parameters

x The _Q2_13 input value from which to calculate cosine(x).

Returns

_LIBQ_Q15_cos_Q2_13 returns the _Q15 fixed point result from the calculation cosine(x).

Remarks

Execution Time (cycles): 102 cycles

Program Memory 224 bytes

Error <= 0.00003052 (accurate to least significant _Q15 bit)

Example

_Q15 resultCos;

resultCos = _LIBQ_Q15_cos_Q2_13 ((_Q2_13)0x2171); 

_// _LIBQ_Q15_cos_Q2_13(1.045044) = 0.501862_ _(0x403d)_

C

_Q15 _LIBQ_Q15_cos_Q2_13 (_Q2_13 x );