5.3.70 _Q31abs Function

The function finds the absolute value of a Q31 value.

Include

<libq.h>

Prototype

_Q31 _Q31abs(_Q31 x);

Argument

x a fixed-point number in Q31 format, which ranges from -231 to 231-1. The value of this argument ranges from 2147483648 to 2147483647.

Return Value

This function returns the absolute value of x in Q31 format. The value ranges from 0 to 2147483647.

Note: _Q31abs(-2147483648) = 2147483647.

Also abs (smallest negative number) = largest positive number.