Fix a corner case: tan(large + Inf i) == NaN + NaN i.
This commit is contained in:
parent
c6df46bafb
commit
bc23acdc32
@ -107,6 +107,13 @@ ctanh(double complex z)
|
||||
return (cpack(x, copysign(0, isinf(y) ? y : sin(y) * cos(y))));
|
||||
}
|
||||
|
||||
/*
|
||||
* ctanh(x + i NAN) = NaN + i NaN
|
||||
* ctanh(x +- i Inf) = NaN + i NaN
|
||||
*/
|
||||
if (!isfinite(y))
|
||||
return (cpack(y - y, y - y));
|
||||
|
||||
/*
|
||||
* ctanh(+-huge + i +-y) ~= +-1 +- i 2sin(2y)/exp(2x), using the
|
||||
* approximation sinh^2(huge) ~= exp(2*huge) / 4.
|
||||
|
@ -57,6 +57,9 @@ ctanhf(float complex z)
|
||||
copysignf(0, isinf(y) ? y : sinf(y) * cosf(y))));
|
||||
}
|
||||
|
||||
if (!isfinite(y))
|
||||
return (cpackf(y - y, y - y));
|
||||
|
||||
if (ix >= 0x41300000) { /* x >= 11 */
|
||||
float exp_mx = expf(-fabsf(x));
|
||||
return (cpackf(copysignf(1, x),
|
||||
|
Loading…
x
Reference in New Issue
Block a user