Skip to main content

abs (Function)

This function returns the absolute value of the given parameter. It wraps the java.lang.Math.abs() function.

Syntax

<DOUBLE> math:abs(<INT|LONG|FLOAT|DOUBLE> p1)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
p1The parameter whose absolute value is found.INT LONG FLOAT DOUBLENoYes

Example 1

CREATE STREAM InValueStream (inValue double);

insert into OutMediationStream
select math:abs(inValue) as absValue
from InValueStream;

Regardless of whether the invalue in the input stream holds a value of abs(3) or abs(-3), the function returns 3 since the absolute value of both 3 and -3 is 3. The result directed to OutMediationStream stream.