1.4.3.28 _LIBQ_Q7_8_tan_Q2_13 Function

Calculates the value of tan(x).

Description

_Q7_8 _LIBQ_Q7_8_tan_Q2_13 (_Q2_13 x);

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

Preconditions

None

Parameters

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

Returns

_LIBQ_Q7_8_tan_Q2_13 returns the _Q7_8 fixed point result from the calculation tan(x).

Remarks

Execution Time (cycles): 288 typical (18 to 346)

Program Memory 980 bytes

Error <= 0.00390625 (accurate to least significant _Q7_8 bit)

Example

_Q7_8 resultTan;

resultTan = _LIBQ_Q7_8_tan_Q2_13 ((_Q2_13)0x2e20); 

_// _LIBQ_Q7_8_tan_Q2_13(1.441406) =_ _7.683594 (0x07af)_

C

_Q7_8 _LIBQ_Q7_8_tan_Q2_13 (_Q2_13 x );