about summary refs log tree commit diff
path: root/src/complex/casinl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/complex/casinl.c')
-rw-r--r--src/complex/casinl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/complex/casinl.c b/src/complex/casinl.c
new file mode 100644
index 00000000..f9aa8ded
--- /dev/null
+++ b/src/complex/casinl.c
@@ -0,0 +1,20 @@
+#include "libm.h"
+
+#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
+long double complex casinl(long double complex z)
+{
+	return casin(z);
+}
+#else
+// FIXME
+long double complex casinl(long double complex z)
+{
+	long double complex w;
+	long double x, y;
+
+	x = creall(z);
+	y = cimagl(z);
+	w = cpackl(1.0 - (x - y)*(x + y), -2.0*x*y);
+	return clogl(cpackl(-y, x) + csqrtl(w));
+}
+#endif