atan2()

The system function MathLib.atan2 computes the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value. The result is in radians and is in the range of -pi to pi.

  MathLib.atan2(
    numericField1 mathLibNumber in,
    numericField2 mathLibNumber in)
  returns (result mathLibTypeDependentResult)
result
Any numeric or HEX item, as described in Mathematical (system words). The value returned by MathLib.atan2 is converted to the format of result and returned in result.
numericField1
Any numeric or HEX item, as described in Mathematical (system words). The item is converted to double-precision floating point before MathLib.atan2 is called. numericField1 is the y value.
numericField2
Any numeric or HEX item, as described in Mathematical (system words). The item is converted to double-precision floating point before MathLib.atan2 is called. numericField2 is the x value.

Example

  myItemY = 1;
  myItemX = 5;

  // returns pi/2
  result = MathLib.atan2(myItemY, myItemX);

Related reference
EGL library MathLib

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.