[PATCH] Compute correct sign for ctanh (Inf + iy) (BZ #17118)

Joseph S. Myers joseph@codesourcery.com
Mon Aug 11 15:59:00 GMT 2014


On Mon, 11 Aug 2014, Andreas Schwab wrote:

> @@ -32,8 +32,15 @@ __ctanh (__complex__ double x)
>      {
>        if (__isinf_ns (__real__ x))
>  	{
> +	  int icls = fpclassify (__imag__ x);
> +	  double sin2ix;
> +
> +	  if (__glibc_likely (icls != FP_SUBNORMAL))
> +	    sin2ix = sin (2 * __imag__ x);

That looks like it will cause spurious overflows if 2 * __imag__ x 
overflows (you can use sin * cos to get the right sign instead).

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list