5.3.1 _Q15abs Function
The function finds the absolute value of a Q15 value.
Include
<libq.h>
Prototype
_Q15 _Q15abs(_Q15 x);
Argument
x |
a fixed-point number in Q15 format, which ranges from -215 to 215-1. The value of this argument ranges from -32768 to 32767. |
Return Value
This function returns the absolute value of x
in Q15
format. The value ranges from 0 to 32767.
Note:
_Q15abs(-32768) = 32767
.
Also abs (smallest negative number) = largest positive number.