3.11.13 Q14_MULTIPLY Macro

C

#define   Q14_MULTIPLY(x, y )   (int16_t)(( (int32_t)(x)  * (int32_t)(y)) >> 14U )

Summary

Performs multiplication of two fixed-point numbers represented in Q14 format.

Description

This macro performs multiplication of two fixed-point numbers represented in Q14 format. Q14 is a common fixed-point representation where a 16-bit signed integer is used to represent a value between -2 and 2. The result of the multiplication is also a Q14 formatted value.

Example

int16_t a = 8192;  // 0.5 in Q14 format
int16_t b = 16384; // 1.0 in Q14 format

int16_t result = Q14_MULTIPLY(a, b);  
    

Remarks

None