blob: 1b653aa930cbd2954a134f4b6a0962ac24ee6c7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#include <complex.h> // for cexp, cimag, complex, creal, I
#include <math.h> // for cos, exp, sin
double complex cexp(double complex z)
{
double r, x, y;
x = creal(z);
y = cimag(z);
r = exp(x);
return r * cos(y) + r * sin(y) * I;
}
|