Name

atan2 function — Computes inverse tangent

Synopsis

float atan2(float y, float x)
double atan2(double y, double x)
long double atan2(long double y, long double x)
image with no caption

The atan2 function returns the inverse tangent of y/x using the sign of both numbers to determine the quadrant for the return value. It correctly handles the case in which x is 0. (That is, it returns π/2 times the sign of y for nonzero y; if y is 0, the result is implementation-defined and might be a range error). The return value is in the range [-π, π].

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.