mirror of
https://git.musl-libc.org/git/musl
synced 2025-03-19 17:13:08 +03:00
complex: fix ctanh(+-0+i*nan) and ctanh(+-0+-i*inf)
These cases were incorrect in C11 as described by http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1886.htm
This commit is contained in:
parent
e98a54643e
commit
b02eed9c48
@ -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 NAN) = NaN + i NaN
|
||||||
* ctanh(x +- i Inf) = NaN + i NaN
|
* ctanh(x +- i Inf) = NaN + i NaN
|
||||||
*/
|
*/
|
||||||
if (!isfinite(y))
|
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
|
* ctanh(+-huge + i +-y) ~= +-1 +- i 2sin(2y)/exp(2x), using the
|
||||||
|
@ -50,7 +50,7 @@ float complex ctanhf(float complex z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isfinite(y))
|
if (!isfinite(y))
|
||||||
return CMPLXF(y - y, y - y);
|
return CMPLXF(ix ? y - y : x, y - y);
|
||||||
|
|
||||||
if (ix >= 0x41300000) { /* x >= 11 */
|
if (ix >= 0x41300000) { /* x >= 11 */
|
||||||
float exp_mx = expf(-fabsf(x));
|
float exp_mx = expf(-fabsf(x));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user