first commit of the new libm!
[musl] / src / complex / cacos.c
diff --git a/src/complex/cacos.c b/src/complex/cacos.c
new file mode 100644 (file)
index 0000000..3aca051
--- /dev/null
@@ -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));
+}