ABS - Absolute value

Language reference ›› Built-in functions ›› Math ››
Parent Previous Next

ABS(expression)        

Returns the absolute value of the given expression.


If the given expression results to an integer size different from INTEGER or LONGINT, the function returns the expression unchanged (unsigned expression). Else the ABS value is generated as Result := - <expression> if <expression> is negative.


Side effect for integer values: if <expression> is equal to the minimum value of the expression width, the result is <expression> (ABS(-32768) result is -32768).


If <expression> returns a floating point value, the result is of the same type as <expression>.