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/cacoshf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/complex/cacoshf.c') diff --git a/src/complex/cacoshf.c b/src/complex/cacoshf.c index d7e6b545..8bd80581 100644 --- a/src/complex/cacoshf.c +++ b/src/complex/cacoshf.c @@ -2,6 +2,9 @@ float complex cacoshf(float complex z) { + int zineg = signbit(cimagf(z)); + z = cacosf(z); - return CMPLXF(-cimagf(z), crealf(z)); + if (zineg) return CMPLXF(cimagf(z), -crealf(z)); + else return CMPLXF(-cimagf(z), crealf(z)); } -- cgit 1.4.1