math.atan2() function

The math.atan2() function returns the arc tangent of y/x, using the signs of the two to determine the quadrant of the return value.

*Output data type: Float*

  1. import "math"
  2. math.atan2(y: 1.22, x: 3.14)
  3. // Returns 0.3705838802763881

Parameters

y

The y coordinate used in the operation.

*Data type: Float*

x

The x coordinate used in the operation.

*Data type: Float*

Special cases

  1. math.atan2(y:y, x:NaN) // Returns NaN
  2. math.atan2(y: NaN, x:x) // Returns NaN
  3. math.atan2(y: +0, x: >=0) // Returns +0
  4. math.atan2(y: -0, x: >=0) // Returns -0
  5. math.atan2(y: +0, x: <=-0) // Returns +Pi
  6. math.atan2(y: -0, x: <=-0) // Returns -Pi
  7. math.atan2(y: >0, x: 0) // Returns +Pi/2
  8. math.atan2(y: <0, x: 0) // Returns -Pi/2
  9. math.atan2(y: +Inf, x: +Inf) // Returns +Pi/4
  10. math.atan2(y: -Inf, x: +Inf) // Returns -Pi/4
  11. math.atan2(y: +Inf, x: -Inf) // Returns 3Pi/4
  12. math.atan2(y: -Inf, x: -Inf) // Returns -3Pi/4
  13. math.atan2(y:y, x: +Inf) // Returns 0
  14. math.atan2(y: >0, x: -Inf) // Returns +Pi
  15. math.atan2(y: <0, x: -Inf) // Returns -Pi
  16. math.atan2(y: +Inf, x:x) // Returns +Pi/2
  17. math.atan2(y: -Inf, x:x) // Returns -Pi/2