about summary refs log tree commit diff
path: root/src/complex/cacos.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/complex/cacos.c')
-rw-r--r--src/complex/cacos.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/complex/cacos.c b/src/complex/cacos.c
new file mode 100644
index 00000000..3aca0519
--- /dev/null
+++ b/src/complex/cacos.c
@@ -0,0 +1,11 @@
+#include "libm.h"
+
+// FIXME: Hull et al. "Implementing the complex arcsine and arccosine functions using exception handling" 1997
+
+/* acos(z) = pi/2 - asin(z) */
+
+double complex cacos(double complex z)
+{
+	z = casin(z);
+	return cpack(M_PI_2 - creal(z), -cimag(z));
+}