Skip to main content

atan (Function)

If a single p1 is received, then this function returns the arc-tangent (inverse tangent) value of p1.

If p1 is received along with an optional p1, then it considers them as x and y coordinates and returns the arc-tangent (inverse tangent) value. The returned value is in radian scale. This function wraps the java.lang.Math.atan() function.

Syntax

<DOUBLE> math:atan(<INT|LONG|FLOAT|DOUBLE> p1)
<DOUBLE> math:atan(<INT|LONG|FLOAT|DOUBLE> p1, <INT|LONG|FLOAT|DOUBLE> p2)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
p1The value of the parameter whose arc-tangent (inverse tangent) is found. If the optional second parameter is given this represents the x coordinate of the (x,y) coordinate pair.INT LONG FLOAT DOUBLENoYes
p2This optional parameter represents the y coordinate of the (x,y) coordinate pair.0DINT LONG FLOAT DOUBLEYesYes

Example 1

CREATE STREAM InValueStream (inValue1 double, inValue2 double);

@info(name = 'calculateArcTangent')
INSERT INTO OutMediationStream
SELECT math:atan(inValue1, inValue2) AS convertedValue
FROM InValueStream;

The query calculates the arc-tangent value of inValue1 and inValue2 from the input stream InValueStream using the math:atan() function.

If only inValue1 is given, then the function computes the arc-tangent value of it and returns the result to the output stream OutMediationStream.

If both inValue1 and inValue2 are given, then the function treats them as x and y coordinates, respectively, and returns the calculated arc-tangent value to the output stream OutMediationStream. For example, atan(12d, 5d) returns 1.1760052070951352.