Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cexp.c « complex « mingwex « mingw « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 43ac9ab9e740a8c4c8dd79495a360cb76ed26eef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
   cexp.c
   Contributed by Danny Smith
   2003-10-20
*/

#include <math.h>
#include <complex.h>

/* cexp (x + I * y) = exp (x) * cos (y) + I * exp (x) * sin (y) */

double complex cexp (double complex Z)
{
  double complex  Res;
  long double rho = exp (__real__ Z);
  __real__ Res = rho * cos(__imag__ Z);
  __imag__ Res = rho * sin(__imag__ Z);
  return Res;
}