summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/mingwex/complex/cexpf.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/complex/cexpf.c')
-rwxr-xr-xwinsup/mingw/mingwex/complex/cexpf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/complex/cexpf.c b/winsup/mingw/mingwex/complex/cexpf.c
new file mode 100755
index 000000000..fabb1a0cb
--- /dev/null
+++ b/winsup/mingw/mingwex/complex/cexpf.c
@@ -0,0 +1,19 @@
+/*
+ cexpf.c
+ Contributed by Danny Smith
+ 2004-12-24
+*/
+
+#include <math.h>
+#include <complex.h>
+
+/* cexp (x + I * y) = exp (x) * cos (y) + I * exp (x) * sin (y) */
+
+float complex cexpf (float complex Z)
+{
+ float complex Res;
+ double rho = exp (__real__ Z);
+ __real__ Res = rho * cosf(__imag__ Z);
+ __imag__ Res = rho * sinf(__imag__ Z);
+ return Res;
+}