ATAN2(Y,X) returns the arc tangent using both argument signs to determine the correct quadrant. It is related to ATAN(Y/X), but preserves quadrant information.
SELECT ATAN2(8, 6); -- Output: 0.927295218001612
SELECT ATAN2(0.1, 0.3); -- Output: 0.321750554396642
SELECT ATAN2(0, 0); -- Output: 0
SELECT ROUND(ATAN2(5, 6), 2); -- Output: 0.69
SELECT ROUND(ATAN2(-3, -8), 2); -- Output: -2.78
SELECT ROUND(ATAN2(9, -15), 2); -- Output: 2.60
SELECT ATAN2(Y, X);
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.