ABS Function

Purpose

Returns the absolute value of an arithmetic value.

Syntax

ABS(x)

Parameters

x is an arithmetic expression.

Description

ABS(x) returns the absolute value of x.

The result has the same data type and precision as x.

Examples

ABS(-132)  /* returns 132 */ 
ABS(12.5)  /* returns 12.5 */

Restrictions

The ABS function may produce unexpected results when x is fixed binary and has the maximum negative value for its precision. For example, if x is Fixed Binary(15) and has the value -32768, ABS(x) is -32768.