diff options
author | Michael Morrell <mmorrell@tachyum.com> | 2019-10-14 09:07:31 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-10-14 09:08:22 -0400 |
commit | aa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0 (patch) | |
tree | 85e6f04af86717b8984f132e84b01c484e20810d /src/complex/cacoshf.c | |
parent | ea9525c8bcf6170df59364c4bcd616de1acf8703 (diff) | |
download | musl-aa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0.tar.gz |
fix cacosh results for arguments with negative imaginary part
Diffstat (limited to 'src/complex/cacoshf.c')
-rw-r--r-- | src/complex/cacoshf.c | 5 |
1 files changed, 4 insertions, 1 deletions
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)); } |