fork(4) download
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <complex.h>
  4.  
  5. #ifndef M_PI_2
  6. #define M_PI_2 (3.1415927/2)
  7. #endif
  8.  
  9. int main()
  10. {
  11. double complex z = 5 * cexp(M_PI_2 *I);
  12. printf("%f * e^(%f * i) = %f + %f * i\n", cabs(z), carg(z), creal(z), cimag(z));
  13.  
  14. return 0;
  15. }
  16.  
  17.  
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
5.000000 * e^(1.570796 * i) = -0.000000 + 5.000000 * i