This question already has an answer here:
To choose two needed solutions, you have to check whether $-2xy=v$.
If you work with the system
$x^2-y^2 = u \\
2xy = v$
you obtain, provided $x \neq 0$, that $y = v/2x$ and $4x^4-4ux^2-v^2 = 0$
From $4x^4-4u^2x^2-v^2 = 0$ you obtain two complex and two real values for $x$. Each real value for $x$ corresponds to only one real value for $y$ ($y = v/2x$), and those give the two square roots of $u+iv$.
This means that in your expressions, you have to pick the same signs if $v>0$, and pick opposite signs if $v<0$.
(and also your expressions seem to lack a division by $2$ somewhere).
The following way is elementary but it works. Let you want to find $\sqrt{x+yi}$. Set $$\sqrt{x+yi}=a+bi$$ then $$x+iy=(a+ib)^2=a^2-b^2+2iab$$ so $$x=a^2-b^2,~~~y=2ab$$ by solving the equations simultaneously, we have: $$a=\sqrt{\frac{\sqrt{x^2+y^2}+x}{2}},~~b=\sqrt{\frac{\sqrt{x^2+y^2}-x}{2}}$$Note that $\sqrt{x+yi}=\pm(a+bi)$