summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/complex/casinl.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/complex/casinl.c')
-rw-r--r--libc-top-half/musl/src/complex/casinl.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/complex/casinl.c b/libc-top-half/musl/src/complex/casinl.c
new file mode 100644
index 0000000..072adc4
--- /dev/null
+++ b/libc-top-half/musl/src/complex/casinl.c
@@ -0,0 +1,21 @@
+#include "complex_impl.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 = CMPLXL(1.0 - (x - y)*(x + y), -2.0*x*y);
+ long double complex r = clogl(CMPLXL(-y, x) + csqrtl(w));
+ return CMPLXL(cimagl(r), -creall(r));
+}
+#endif