1.4.4.20 Fract_XoverY_Q15bfpFromQ15 Function

fract_q15bfp_t Fract_XoverY_Q15bfpFromQ15(fract_q15_t x, fract_q15_t y )

Summary

Calculate ratio of X/Y as Q15s but return result as Q15 block floating point.

Description

Calculate ratio of X/Y as Q15s but return result as Q15 block floating point.

Preconditions

None.

Parameters

x Q15 numerator

y Q15 denominator

Returns

Ratio x/y as Q15 block floating point

Remarks

None.

Example

fract_q15_t x,y;

fract_q15bfp_t XoverY;

x = 0x1234; _// 4660/32768 = 0.142219_

y = 0x5678; _// 22136/32768 = 0.675537_

XoverY = Fract_XoverY_Q15bfpFromQ15(x,y);

_// x/y = 4660/22136 = 6898/32768 = 0.210516_

_// XoverY.m = 0x6BC8 = 27592_

_// XoverY.e = 0xFFFE = -2_

_// XoverY = (27592/32768)>>2 = 0.210510_

C

fract_q15bfp_t Fract_XoverY_Q15bfpFromQ15 (fract_q15_t x , fract_q15_t y );