diff options
Diffstat (limited to 'src/complex/cacosh.c')
-rw-r--r-- | src/complex/cacosh.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/complex/cacosh.c b/src/complex/cacosh.c index 8c68cb01..55b857ce 100644 --- a/src/complex/cacosh.c +++ b/src/complex/cacosh.c @@ -1,9 +1,12 @@ -#include "libm.h" +#include "complex_impl.h" -/* acosh(z) = i acos(z) */ +/* acosh(z) = ±i acos(z) */ 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)); } |