1.4.4.13 Fract_InversePower Function

fract_q15bfp_t Fract_InversePower( uint16_t nBase, uint16_t nExponent )

Summary

Computes pow(nBase,-nExponent).

Description

Computes pow(nBase,-nExponent).

Preconditions

None

Returns

pow(nBase,-nExponent), as a Q15bfp block floating point number.

Remarks

pow(nBase,nExponent) must fit inside a uint32_t variable.

Example

uint16_t nBase, nExponent;

fract_q15bfp_t Answer;

nBase = 5;

nExponent = 3;

Answer = Fract_InversePower(nBase,nExponent);

_// Answer = pow(5,-3) = 1/125_

_// Answer.m = 0x4189 = 16777_

_// Answer.e = 0xFFFA = -6_

_// Answer = (16777/32768)>>6 = 1/(125.001609)_

C

fract_q15bfp_t Fract_InversePower (uint16_t nBase , uint16_t nExponent );