For a complex number of the form a+bi, IMSQRT implements the following equation:
sign(b) ensures that the imaginary part of the complex number passed in the argument has the same sign as its principal square root.