C++ Math atan2()Last Updated : 17 Mar 2025 The function finds the inverse tangent of a coordinate. Suppose the coordinate is (x,y): atan2(y,x) = tan-1(y/x); SyntaxSuppose the coordinate is (x,y). Syntax would be: Parametery: It represents the y-coordinate value. x: It represents the x-coordinate value. Return valueIt returns the value in the range[-?, ?] and if the values of both x and y are zero then it returns zero value.
Example 1Let's see a simple example when both x and y are zero. Output: Value of tan(y/x) is : 0 Value of tan-1(y/x) is : 0 In this example, atan2() calculates the inverse tangent when both 'x' and 'y' are zero. Example 2Let's see a simple example when both 'x' and 'y' are of different type. Output: Value of tan(y/x) is : 3.6021 Value of tan1(y/x) is : 0.915101 In this example, atan2() function finds the inverse of a tangent when x is of integer type and y is of float type. Next TopicC++ Math Functions |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India