diff options
Diffstat (limited to 'libc-top-half/musl/src/complex/casin.c')
-rw-r--r-- | libc-top-half/musl/src/complex/casin.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/complex/casin.c b/libc-top-half/musl/src/complex/casin.c new file mode 100644 index 0000000..3244beb --- /dev/null +++ b/libc-top-half/musl/src/complex/casin.c @@ -0,0 +1,17 @@ +#include "complex_impl.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 = CMPLX(1.0 - (x - y)*(x + y), -2.0*x*y); + double complex r = clog(CMPLX(-y, x) + csqrt(w)); + return CMPLX(cimag(r), -creal(r)); +} |