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/cacosh.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/complex/cacosh.c') diff --git a/src/complex/cacosh.c b/src/complex/cacosh.c index 8e42f1ae..76127f75 100644 --- a/src/complex/cacosh.c +++ b/src/complex/cacosh.c @@ -4,6 +4,9 @@ double complex cacosh(double complex z) { + int zineg = signbit(cimag(z)); + z = cacos(z); - return CMPLX(-cimag(z), creal(z)); + if (zineg) return CMPLX(cimag(z), -creal(z)); + else return CMPLX(-cimag(z), creal(z)); } -- cgit 1.4.1