about summary refs log tree commit diff
path: root/src/complex/cacoshl.c
diff options
context:
space:
mode:
authorMichael Morrell <mmorrell@tachyum.com>2019-10-14 09:07:31 -0400
committerRich Felker <dalias@aerifal.cx>2019-10-14 09:08:22 -0400
commitaa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0 (patch)
tree85e6f04af86717b8984f132e84b01c484e20810d /src/complex/cacoshl.c
parentea9525c8bcf6170df59364c4bcd616de1acf8703 (diff)
downloadmusl-aa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0.tar.gz
musl-aa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0.tar.xz
musl-aa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0.zip
fix cacosh results for arguments with negative imaginary part
Diffstat (limited to 'src/complex/cacoshl.c')
-rw-r--r--src/complex/cacoshl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/complex/cacoshl.c b/src/complex/cacoshl.c
index d3eaee20..3a284be9 100644
--- a/src/complex/cacoshl.c
+++ b/src/complex/cacoshl.c
@@ -8,7 +8,10 @@ long double complex cacoshl(long double complex z)
 #else
 long double complex cacoshl(long double complex z)
 {
+	int zineg = signbit(cimagl(z));
+
 	z = cacosl(z);
-	return CMPLXL(-cimagl(z), creall(z));
+	if (zineg) return CMPLXL(cimagl(z), -creall(z));
+	else       return CMPLXL(-cimagl(z), creall(z));
 }
 #endif