December 2005
Beginner to intermediate
618 pages
20h 19m
English
cpow
Raises a complex number to a complex power
#include <complex.h> double complexcpow( double complexx, double complexy); float complexcpowf( float complexx, float complexy); long double complexcpowl( long double complexx, long double complexy);
The cpow() function raises
its first complex argument x to the power
of the second argument, y. In other
words, it returns the value of
xy.
The cpow() function has a
branch cut along the negative real axis to yield a unique
result.
double complex z = 0.0 + 2.7 * I;
double complex w = 2.7 + 0.0 * I;
double complex c =cpow(w, z); // Raise e to the power of i*2.7
printf("%.2f %+.2f \xD7 I raised to the power of %.2f %+.2f \xD7 I "
"is %.2f %+.2f \xD7 I.\n",
creal(w), cimag(w), creal(z), cimag(z), creal(c), cimag(c));This code produces the following output:
2.70 +0.00 × I raised to the power of 0.00 +2.70 × I is -0.90 +0.44 × I.
Read now
Unlock full access