Floating point complex square root
Calculating the complex square root requires some care. The naive method may encounter overflow, underflow, or loss of precision due to the intermediate floating point results. A simple remedy is:
Then using w,
Calculates sqrt(a + ib) and returns a two-element JS array with the real and imaginary components of the answer.
result is an optional to-element
Array or typed array into which output is passed, if provided.
var sqrt = ;var result = ;// result = [ 1.272019649514069, 0.7861513777574233 ]
 Press, William H. Numerical Recipes 3rd Edition: The Art of Scientific Computing. Cambridge University Press, 2007.
(c) 2015 Ricky Reusser. MIT License