# atan2

where is the principal value of the arctangent, ie. the one in the interval .

## Properties

A 3D plot of atan2(y, x).
• for any .
• Discontinuous along : For any :

### Partial derivatives

The partial derivatives, just like the function itself, are defined everywhere except at the origin. Furthermore, unlike the function, they're not discontinuous along (except at the origin).

Interesingly, the function has the same partial derivatives.

## Systems of equations involving the cosine and the sine of an unknown

A geometric intepretation: θ = atan2(y,x).

Let . Consider the following system of equations:

If , this system has a unique (up to a multiple of ) solution:

for any . For simplicity k is often set to zero.

Because (up to a multiple of ), atan2 can be thought of as the “inverse” of the cosine and sine of the same argument.

## C's atan2

The definition at the beginning of this article is suitable for mathematical analysis. However, a more intricate definition is needed for floating-point computation, one that takes signed zeros and infinites into account. The following appears in the C standard:

In this definition is not undefined.