1.4.4.4 Fract_10toX_Q15d16 Function
fract_q15d16_t Fract_10toX_Q15d16( fract_q15d16_t x )
Summary
Calculates pow(2,x) with fixed point math.
Description
Calculates pow(2,x) using fixed point math, with x as Q15.16, returning result as Q15.16.
Preconditions
None.
Parameters
x exponent as Q15.16
Returns
pow(2,x) as Q15.16
Remarks
Fract_10toX(x) is basically Fract_2toX( log2(10)*x ).
Example
fract_q15d16_t x,y; x = 0x00008000; _// 0.5_ y = Fract_10toX_Q15d16(x); _// y = 0x0003 2990 = 207,248/65536 = 3.162353 (vs. 3.162277) , rel error = 1/41688_ x = 0x0003243F; _// 205,887 / 65536 = 3.141586 (vs. 3.14159)_ y = Fract_10toX_Q15d16(x); _// y = 0x0569 6000 = 90,791,936/65536 = 1385.375 (vs. 1385.435475) , rel error = 1/22909_
C
fract_q15d16_t Fract_10toX_Q15d16 (fract_q15d16_t x );