fix cacosh results for arguments with negative imaginary part

This commit is contained in:
Michael Morrell 2019-10-14 09:07:31 -04:00 committed by Rich Felker
parent ea9525c8bc
commit aa2d23e57c
3 changed files with 12 additions and 3 deletions

View File

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

View File

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

View File

@ -8,7 +8,10 @@ long double complex cacoshl(long double complex 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