cpow Function

Calculates the complex power function xy for double precision complex values.

Attention: This function is implemented only by MPLAB XC32 C compilers.

Include

<complex.h>

Prototype

double complex cpow(double complex x, double complex y);

Arguments

x
the base value
y
the exponent, or power, value

Return Value

Returns the complex power function xy, with a branch cut for the base value (x) along the negative real axis.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <stdio.h>
#include <complex.h>

int main(void)
{
  double complex x, y, z;
  x = -2.0 + 1.0*I;
  y = 0.2 - 1.3*I;
  z = cpow(x, y);
  printf("The complex value %f + %fi raised to the value %f + %fi is %f + %fi\n", creal(x), cimag(x), creal(y), cimag(y), creal(z), cimag(z));

}

Example Output

The complex value -2.000000 + 1.000000i raised to the value 0.200000 + -1.300000i is 33.309896 + -18.656049i