I am converting some Python code to C code.
Below Python NumPy exp on complex number outputs (6.12323399574e-17-1j)
for k=1
, l=4
.
numpy.exp(-2.0*1j*np.pi*k/l)
I convert it to C code like below. But the output is 1.000000
.
#include <complex.h>
#define PI 3.1415926535897932384626434
exp(-2.0*I*PI*k/l)
What am I missing?
Here's the right C code to print out your answer: