Jump to main content

##

# 3.11.14 Q14_DIVISION Macro

## C

    #define   Q14_DIVISION( x, y)      (int16_t)(((int32_t)x * (int32_t)Q14_SCALE_FACTOR ) / y )

## Summary

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

## Description

This macro performs macro performs division of two Q14 (fixed-point) numbers. It scales the dividend (`x`) by a constant `Q14_SCALE_FACTOR`( 2 14 ) before dividing it by the divisor (`y`). The result is a Q14 formatted number, with appropriate scaling to handle the fixed-point arithmetic.

## Example

    int16_t a = 8192;  // Example numerator in Q14 format (0.5 in Q14 format)
    int16_t b = 2;   // Denominator
    int16_t result = Q14_DIVISION(a, b);

## Remarks

None