csqrt Function (ROM Call 0x146)

math.h, timath.h

void csqrt (float z_re, float z_im, float *w_re, float *w_im);

Complex square root.

csqrt calculates the square root w = sqrt(z) of the complex number which real and imaginary parts are z_re and z_im, and stores real and imaginary part of the result in floating point destinations pointed to by w_re and w_im. The complex square root is defined by

sqrt(z) = sqrt(abs(z)) (cos(arg(z)/2) + i sin(arg(z)/2))

where abs(z) = sqrt(z_re^2+z_im^2) and arg(z) = atan2(z_im, z_re). See sqrt, atan2, sin and cos.


Uses: _bcd_math
Used by: push_sqrt