about summary refs log tree commit diff
path: root/src/complex
diff options
context:
space:
mode:
Diffstat (limited to 'src/complex')
-rw-r--r--src/complex/casin.c3
-rw-r--r--src/complex/casinf.c3
-rw-r--r--src/complex/casinl.c3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/complex/casin.c b/src/complex/casin.c
index dfdda988..01ed6184 100644
--- a/src/complex/casin.c
+++ b/src/complex/casin.c
@@ -12,5 +12,6 @@ double complex casin(double complex z)
 	x = creal(z);
 	y = cimag(z);
 	w = CMPLX(1.0 - (x - y)*(x + y), -2.0*x*y);
-	return clog(CMPLX(-y, x) + csqrt(w));
+	double complex r = clog(CMPLX(-y, x) + csqrt(w));
+	return CMPLX(cimag(r), -creal(r));
 }
diff --git a/src/complex/casinf.c b/src/complex/casinf.c
index 93f0e335..4fcb76fc 100644
--- a/src/complex/casinf.c
+++ b/src/complex/casinf.c
@@ -10,5 +10,6 @@ float complex casinf(float complex z)
 	x = crealf(z);
 	y = cimagf(z);
 	w = CMPLXF(1.0 - (x - y)*(x + y), -2.0*x*y);
-	return clogf(CMPLXF(-y, x) + csqrtf(w));
+	float complex r = clogf(CMPLXF(-y, x) + csqrtf(w));
+	return CMPLXF(cimagf(r), -crealf(r));
 }
diff --git a/src/complex/casinl.c b/src/complex/casinl.c
index 0916c60f..3b7ceba7 100644
--- a/src/complex/casinl.c
+++ b/src/complex/casinl.c
@@ -15,6 +15,7 @@ long double complex casinl(long double complex z)
 	x = creall(z);
 	y = cimagl(z);
 	w = CMPLXL(1.0 - (x - y)*(x + y), -2.0*x*y);
-	return clogl(CMPLXL(-y, x) + csqrtl(w));
+	long double complex r = clogl(CMPLXL(-y, x) + csqrtl(w));
+	return CMPLXL(cimagl(r), -creall(r));
 }
 #endif