Jump to main content

##

# 3.11.9 Q15_DIVISION Macro

## C

    #define   Q15_DIVISION( x, y)      (int16_t)(((int32_t)x * (int32_t)Q15_SCALE_FACTOR ) / y )

## Summary

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

## Description

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

## Example

    int16_t a = 16384;  // This is 0.5 in Q15 format
    int16_t b = 32767;  // This is 1.0 in Q15 format

    int16_t result = Q15_DIVISION(a, b)

## Remarks

None