Derivation of fixed-point $\tt atan2$ with self-normalization
it's an approximation.

a better approximation is in this answer:

$$ \arctan(u) \approx \frac{u}{f(u^2)}  \quad \quad -1 \le u \le 1  $$

where

$$ \begin{align}
f(u^2)&amp; = \sum\limits_{n=0}^{4} \ a_n \ u^{2n} \\
a_0  &amp;  =  1.0 \\
a_1  &amp;  =  0.33288950512027 \\
a_2  &amp;  =  -0.08467922817644 \\
a_3  &amp;  =  0.03252232640125 \\
a_4  &amp;  =  -0.00749305860992 \\
\end{align} $$

not as fast, but quite accurate.  not bit-perfect accurate, but very accurate.

for atan2(), you need to put it in the correct tilted quadrant:

$$ \operatorname{atan2}(y,x) = \arg\{ x + j\,y \} =
\begin{cases}
\arctan\left(\frac{y}{x}\right) &amp;\text{if } 0 &lt; |y| \le x, \\
\frac{\pi}{2} - \arctan\left(\frac{x}{y}\right) &amp;\text{if } 0 &lt; |x| \le y, \\
-\frac{\pi}{2} - \arctan\left(\frac{x}{y}\right) &amp;\text{if } y \le -|x| &lt; 0, \\
\arctan\left(\frac{y}{x}\right) \pm \pi &amp;\text{if } x \le -|y| &lt; 0, \\
\text{undefined} &amp;\text{if } x = 0 \text{ and } y = 0.
\end{cases} $$

this will require two fixed-point divisions, but you can arrange it so that the result is always no greater than 1 in magnitude (the numerator is always smaller in magnitude than the denominator).