only use memcpy realloc to shrink if an exact-sized free chunk exists
[oweals/musl.git] / src / complex / cacosh.c
index 8c68cb01fd6039eafaa856a7f3130a425b7504f6..76127f75f4bb1b4369bf98d209c0089e2ff86bca 100644 (file)
@@ -1,9 +1,12 @@
-#include "libm.h"
+#include "complex_impl.h"
 
 /* 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));
 }