1.4.3.11 _LIBQ_Q2_13_acos_Q15 Function

Calculates the value of acos(x).

Description

_Q2_13 _LIBQ_Q2_13_acos_Q15 (_Q15 x);

Calculates the acos(x), where x is of type _Q15 and the resulting value is of type _Q2_13. The output value will be radians in the range pi >= result >= -pi.

Preconditions

None.

Parameters

x The _Q15 input value from which to calculate acos(x).

Returns

_LIBQ_Q2_13_acos_Q15 returns the _Q2_13 fixed point result from the calculation acos(x).

Remarks

The function _LIBQ_Q2_13_asin_Q15 is called by this routine and thus must be linked into the executable image.

Execution Time (cycles): 588 typical (32 to 666)

Program Memory 24 bytes

Error <= 0.00012207 (accurate to least significant _Q2_13 bit)

A higher precision function with equivalent performance exists, see _LIBQ_Q2_29_acos_Q31_Fast

Example

_Q2_13 resultAcos;

resultAcos = _LIBQ_Q2_13_acos_Q15((_Q15)0x2993); 

_// _LIBQ_Q2_13_acos_Q15(0.324799) = 1.239990_ _(0x27ae)_

C

_Q2_13 _LIBQ_Q2_13_acos_Q15 (_Q15 x );