1.4.3.13 _LIBQ_Q2_13_atan_Q7_8 Function

Calculates the value of atan(x).

Description

_Q2_13 _LIBQ_Q2_13_atan_Q7_8 (_Q7_8 x);

Calculates the atan(x), where x is of type _Q7_8 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 _Q7_8 input value from which to calculate atan(x).

Returns

_LIBQ_Q2_13_atan_Q7_8 returns the _Q2_13 fixed point result from the calculation atan(x).

Remarks

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

Execution Time (cycles): 240 typical (202 to 256)

Program Memory 16 bytes

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

Example

_Q2_13 resultAtan;

resultAtan = _LIBQ_Q2_13_atan_Q7_8 ((_Q7_8)0x0097); 

_// _LIBQ_Q2_13_atan_Q7_8(0.589844) =_ _0.532959 (0x110e)_

C

_Q2_13 _LIBQ_Q2_13_atan_Q7_8 (_Q7_8 x );