1.4.3.15 _LIBQ_Q2_29_acos_Q31 Function

Calculates the value of acos(x).

Description

_Q2_29 _LIBQ_Q2_29_acos_Q31 (_Q31 x);

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

Preconditions

None.

Parameters

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

Returns

_LIBQ_Q2_29_acos_Q31 returns the _Q2_29 fixed point result from the calculation acos(x).

Remarks

The functions _LIBQ_Q2_29_asin_Q31_Fast and _LIBQ_Q31_cos_Q2_29 are called by this routine and thus must be linked into the executable image.

Execution Time (cycles): 3370 typical (70 to 4824)

Program Memory 142 bytes

Error <= 0.0000000019 (accurate to least significant _Q2_29 bit for the range -0.9993..0.9993)

Error <= 0.0000000355 (accurate to 5th least significant _Q2_29 bit for the range -1.0 .. -0.9993 and 0.9993 .. 1.0)

A similar function with higher performance and reduced precision exists, see _LIBQ_Q2_29_acos_Q31_Fast

Example

_Q2_29 resultAcos;

resultAcos = _LIBQ_Q2_29_acos_Q31 ((_Q31)0xee63708c); 

_// _LIBQ_Q2_29_acos_Q31(-0.1375903431)_ _= 1.7088244837 (0x36aeb0af)_

C

_Q2_29 _LIBQ_Q2_29_acos_Q31 (_Q31 x );