arctan2

A function that can be used in Formulas. The argument angle.

### Syntax and semantics

`arctan2` (`y`, `x`)
the angle (in radians) from the X axis to the point (x, y) in two-dimensional space; positive (i.e. measured counterclockwise) for y > 0, and negative (and measured clockwise) for y < 0. For y = 0, it’s 0 if x > 0, and π if x < 0. In the point (0, 0), `arctan2` is undefined.

### Tests

```    assert arctan2 (0.0, 3.0) = 0``` ```    assert abs (arctan2 (3.0, 3.0) - pi/4) < 1e-17``` ```    assert abs (arctan2 (3.0, 0.0) - pi/2) < 1e-17``` ```    assert abs (arctan2 (3.0, -3.0) - 3*pi/4) < 1e-17``` ```    assert abs (arctan2 (0.0, -3.0) - pi) < 1e-17``` ```    assert abs (arctan2 (-3.0, -3.0) + 3*pi/4) < 1e-17``` ```    assert abs (arctan2 (-3.0, 0.0) + pi/2) < 1e-17``` ```    assert abs (arctan2 (-3.0, 3.0) + pi/4) < 1e-17``` ```    ;assert arctan2 (0.0, 0.0) = undefined```

### Edge cases

In C, and therefore in Numpy, `arctan2` has arbitrary values where it cannot be defined. Thus `numpy.arctan2 (0.0, +0.0)` is 0, `numpy.arctan2 (+0.0, -0.0)` is +π, and `numpy.arctan2 (-0.0, -0.0)` is −π. The function is then even defined for e.g. x = −∞ and y = +∞, where it is 3π/4. In all these cases, `arctan` returns `undefined` in Praat. This doesn’t mean that the function is very sane in Praat, as it is still discontinuous for small `y`:

```    writeInfoLine: arctan2 (1e-308, -1.0), " ", arctan2 (-1e-308, -1.0)``` `=>`
```    3.141592653589793 -3.141592653589793```

which are indistinguishable from +π and −π, respectively.