summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/mingwex/complex/clog.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/complex/clog.c')
-rw-r--r--winsup/mingw/mingwex/complex/clog.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/complex/clog.c b/winsup/mingw/mingwex/complex/clog.c
new file mode 100644
index 000000000..57c51ebb0
--- /dev/null
+++ b/winsup/mingw/mingwex/complex/clog.c
@@ -0,0 +1,19 @@
+/*
+ clog.c
+ Contributed by Danny Smith
+ 2003-10-20
+*/
+
+/* clog (x + I * y) = log (hypot (x, y)) + I * atan2 (y, x) */
+
+#include <math.h>
+#include <complex.h>
+
+double complex clog (double complex Z)
+{
+ double complex Res;
+ __real__ Res = log (_hypot (__real__ Z, __imag__ Z));
+ __imag__ Res = carg (Z);
+ return Res;
+}
+