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));
}
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));
}
#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