1.4.3.22 _LIBQ_Q31_cos_Q2_29 Function

Calculates the value of cosine(x).

Description

_Q31 _LIBQ_Q31_cos_Q2_29 (_Q2_29 x);

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

Preconditions

None.

Parameters

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

Returns

_LIBQ_Q31_cos_Q2_29 returns the _Q31 fixed point result from the calculation sine(x).

Remarks

Execution Time (cycles): 265 typical (22 to 288)

Program Memory 746 bytes

Error <= 0.00000000047 (accurate to least significant _Q31 bit)

Example

_Q31 resultCos;

resultCos = _LIBQ_Q31_cos_Q2_29 ((_Q2_29)0x07e2e1c2); 

_// _LIBQ_Q31_cos_Q2_29( 0.246445540) =_ _0.969785686 (0x7c21eff7)_

C

_Q31 _LIBQ_Q31_cos_Q2_29 (_Q2_29 x );