The calculation of the square root of a complex number $a + ib$ involves solving the equation
$$ (x + iy)^2 = a + ib$$
So far so good. One obtains the equations
$$ 4x^4 -4ax^2 - b^2 = 0, y = b/2x$$
and using the quadratic formula for $x^2$ one gets
$$ x = \pm \sqrt{{a + \sqrt{a^2 + b^2} \over 2}}$$
I am supposed to get
$$ y = \pm \sqrt{- a + \sqrt{a^2 + b^2} \over 2} \cdot \text{sgn}(b)$$
but if I substitute $x$ into $y$ I get
$$ y = {b\over 2x} = \pm {b \sqrt{2} \over 2\sqrt{a + \sqrt{a^2 + b^2}}}$$
What am I doing wrong?