mathLib.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.


sysLib.atan2 syntax diagram

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.

numericItem1

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. numericItem1 is the y value.

numericItem2

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. numericItem2 is the x value.

Example

  myItemY = 1;
  myItemX = 5;

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

Related reference
Mathematical (system words)