From aa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0 Mon Sep 17 00:00:00 2001 From: Michael Morrell Date: Mon, 14 Oct 2019 09:07:31 -0400 Subject: fix cacosh results for arguments with negative imaginary part --- src/complex/cacoshl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/complex/cacoshl.c') 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 -- cgit v1.2.1