about summary refs log tree commit diff
path: root/src/complex/ctan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/complex/ctan.c')
-rw-r--r--src/complex/ctan.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/complex/ctan.c b/src/complex/ctan.c
new file mode 100644
index 00000000..4741a4df
--- /dev/null
+++ b/src/complex/ctan.c
@@ -0,0 +1,9 @@
+#include "libm.h"
+
+/* tan(z) = -i tanh(i z) */
+
+double complex ctan(double complex z)
+{
+	z = ctanh(cpack(-cimag(z), creal(z)));
+	return cpack(cimag(z), -creal(z));
+}