about summary refs log tree commit diff
path: root/src/complex/clog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/complex/clog.c')
-rw-r--r--src/complex/clog.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/complex/clog.c b/src/complex/clog.c
new file mode 100644
index 00000000..6f10a115
--- /dev/null
+++ b/src/complex/clog.c
@@ -0,0 +1,14 @@
+#include "libm.h"
+
+// FIXME
+
+/* log(z) = log(|z|) + i arg(z) */
+
+double complex clog(double complex z)
+{
+	double r, phi;
+
+	r = cabs(z);
+	phi = carg(z);
+	return cpack(log(r), phi);
+}