abs(X)

Returns the absolute value of a given value.

Syntax

abs(X)

Input

Argument Type Description
X any numeric type A numeric value

Return Value

Returns a numeric value corresponding to the absolute value of X. The data type of the return value is the same as X.

If X is N/A, the result is N/A. (The data type is integer).

Sample Usage

X abs(X)
-5 5 (integer)
-2.5 2.5 (decimal)
-2.0 2 (decimal)
13 13 (integer)
5.0 5 (decimal)
1.5 1.5 (decimal)
NA NA (integer)

Example

In this example, the abs(X) function returns the absolute value of the dax (Deutsche Boerse AG German Stock Index) on the pub.demo.mleg.uci.istanbul table.

<base table="pub.demo.mleg.uci.istanbul"/>
<colord cols="date, dax"/>
<willbe name="absdax" value="abs(dax)"format="dec:5"/>