1.4.4.44 libq_q1d15_Sin_q10d6 Function

Approximates the sine of an angle.

Description

Function libq_q1d15_Sin_q10d6:

This function approximates the sine of an angle using the following algorithm: sin(x) = 3.140625x + 0.02026367x^2 - 5.325196x^3

  • 0.5446778x^4 + 1.800293x^5. The approximation is accurate for any value of x from 0 degrees to 90 degrees. Because sin(-x) =

  • sin(x) and sin(x) = sin(180 - x), the sine of any angle can be inferred from an angle in the first quadrant. Therefore, any angle > 90 is converted to an angle between 0 & 90. The coefficients of the algorithm have been scaled by 1/8 to fit a Q1d15 format. So the result is scaled up by 8 to obtain the proper magnitudes. The algorithm expects the angle to be in degrees and represented in Q10.6 format. The computed sine value is returned in Q1.15 format.

Preconditions

None.

Parameters

q15 angle - The angle in degrees for which the sine is computed in Q10.6

Returns

q15 sine(angle) value in Q1.15

C

q15 libq_q1d15_Sin_q10d6 (q15 angleQ10d6 );