This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/7955/. Also, please do not modify any references to the original work (if any) contained in this content.
atan2 is based on arc tangent function, but it expects two arguments to correctly determine the result quadrant.
Atan2 calculation algorithm
Arctan2 with all positive x is same as ordinal arc tangent:
For other x values, arctan2 can be calculated according the following table:
|y<0||y = 0||y>0|