C Programming/complex.h/carg

Description
carg is a standard library function which calculates the argument (phase angle) of a complex number. It takes a single parameter and returns the phase angle of that value (converted if necessary to a complex number) within the range [π, −π].

This function takes a single parameter of type complex and returns a result of type double.

A complex number can be represented:
 * in rectangular co-ordinates as $$Z = A + Bi$$
 * in polar co-ordinates as $$z = re^{ia}$$

where:
 * A = creal(Z) is the real part
 * B = cimag(Z) is the imaginary part
 * r = cabs(z) is the radius
 * a = carg(z) is the phase (angle or the argument)

Hence this function returns phase of complex number Z used in polar co-ordinates. The return value is in radians, in the range [π, -π]. When we use this function, we must include the  header file.

Example 1
Output: