about summary refs log tree commit diff
path: root/src/complex/casin.c
blob: 01ed61841ea4dc3447b76ec1b9470114a605fc62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#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 = 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));
}