1.4.4.2 Fract_10toX_Q15bfp Function
fract_q15bfp_t Fract_10toX_Q15bfp( fract_q15bfp_t x )
Summary
Calculates pow(2,x) with fixed point math.
Description
Calculates pow(2,x) using fixed point math, with x as Q15 block floating point, returning the result in the same format.
Preconditions
None.
Parameters
x exponent, in Q15 block floating point format
Returns
pow(2,x), in Q15 block floating point format
Remarks
Fract_10toX(x) is basically Fract_2toX( log2(10)*x ).
Example
fract_q15bfp_t X,Y; X.m = 0x4000; _// 1/2_ X.e = 0; Y = Fract_10toX_Q15bfp(X); _// Y.m = 0x6532 = 25906_ _// Y.e = 2_ _// Y = ( 25906 / 32768 )<<2 = 3.162353 (vs. 3.162277) , rel error = 1/41688_ X.m = 0x6488; _// (3.14159/4)_ X.e = 2; Y = Fract_10toX_Q15bfp(X); _// Y.m = 0x5697 = 22167 / 32768 = 0.676483_ _// Y.e = 0x000B = 11_ _// Y = (22167 / 32768)<<11 = 1385.4375 (vs. 1385.435475), rel error = 1/684,023_
C
fract_q15bfp_t Fract_10toX_Q15bfp (fract_q15bfp_t x );