about summary refs log tree commit diff
path: root/src/complex/casin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/complex/casin.c')
-rw-r--r--src/complex/casin.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/complex/casin.c b/src/complex/casin.c
new file mode 100644
index 00000000..79aff278
--- /dev/null
+++ b/src/complex/casin.c
@@ -0,0 +1,16 @@
+#include "libm.h"
+
+// FIXME
+
+/* asin(z) = -i log(i z + sqrt(1 - z*z)) */
+
+double complex casin(double complex z)
+{
+	double complex w;
+	double x, y;
+
+	x = creal(z);
+	y = cimag(z);
+	w = cpack(1.0 - (x - y)*(x + y), -2.0*x*y);
+	return clog(cpack(-y, x) + csqrt(w));
+}