1.4.4.18 Fract_XminusY_Q15bfp Function

fract_q15bfp_t Fract_XminusY_Q15bfp( fract_q15bfp_t x, fract_q15bfp_t y )

Summary

Subtract two Q15 block floating point numbers.

Description

Subtract two Q15 block floating point numbers.

Preconditions

none.

Parameters

x Q15 block floating point term

y Q15 block floating point term

Returns

x-y as Q15 block floating point

Remarks

None.

Example

fract_q15d16_t x, y;

fract_q15bfp_t X, Y, XminusY;

x = 0x00030000; _// 3_

y = 0x00070000; _// 7_

X = Fract_Convert_Q15d16ToQ15bfp(x);

Y = Fract_Convert_Q15d16ToQ15bfp(y);

XminusY = Fract_XminusY_Q15bfp( X, Y );

_// XplusY.m = 0xC000 = -16384/32768 = -0.5_

_// XPlusY.e = 3_

_// XPlusY = -0.5<<3 = -4_

C

fract_q15bfp_t Fract_XminusY_Q15bfp (fract_q15bfp_t x , fract_q15bfp_t y );