diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/complex/ctanh.c | 4 | ||||
-rw-r--r-- | src/complex/ctanhf.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/complex/ctanh.c b/src/complex/ctanh.c index 0461050d..3ba3a899 100644 --- a/src/complex/ctanh.c +++ b/src/complex/ctanh.c @@ -101,11 +101,13 @@ double complex ctanh(double complex z) } /* + * ctanh(+-0 + i NAN) = +-0 + i NaN + * ctanh(+-0 +- i Inf) = +-0 + i NaN * ctanh(x + i NAN) = NaN + i NaN * ctanh(x +- i Inf) = NaN + i NaN */ if (!isfinite(y)) - return CMPLX(y - y, y - y); + return CMPLX(x ? y - y : x, y - y); /* * ctanh(+-huge + i +-y) ~= +-1 +- i 2sin(2y)/exp(2x), using the diff --git a/src/complex/ctanhf.c b/src/complex/ctanhf.c index a7e1a5fc..72b76da0 100644 --- a/src/complex/ctanhf.c +++ b/src/complex/ctanhf.c @@ -50,7 +50,7 @@ float complex ctanhf(float complex z) } if (!isfinite(y)) - return CMPLXF(y - y, y - y); + return CMPLXF(ix ? y - y : x, y - y); if (ix >= 0x41300000) { /* x >= 11 */ float exp_mx = expf(-fabsf(x)); |