This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCHv6] New generic sinf


On 30/11/17 09:22, Rajalakshmi Srinivasaraghavan wrote:
> Changes since version 4:
> 
>   - Increase pio2_table size to 5 and add comment.
>   - Change exponent calculation to use division.
>   - Use isless for comparison.

isless should be used for all the compares that may compare nan.

i get

testing float (without inline functions)
Failure: sin (qNaN): Exception "Invalid operation" set
Failure: sin (-qNaN): Exception "Invalid operation" set
Failure: sin_downward (qNaN): Exception "Invalid operation" set
Failure: sin_downward (-qNaN): Exception "Invalid operation" set
Failure: sin_towardzero (qNaN): Exception "Invalid operation" set
Failure: sin_towardzero (-qNaN): Exception "Invalid operation" set
Failure: sin_upward (qNaN): Exception "Invalid operation" set
Failure: sin_upward (-qNaN): Exception "Invalid operation" set

> +float
> +SINF_FUNC (float x)
> +{
> +  double cx;
> +  double theta = x;
> +  double abstheta = fabs (theta);
> +  /* If |x|< Pi/4.  */
> +  if (abstheta < M_PI_4)
> +    {
...
> +    }
> +  else                          /* |x| >= Pi/4.  */
> +    {
> +      unsigned long int signbit = (x < 0);
> +      if (abstheta < 9 * M_PI_4)        /* |x| < 9*Pi/4.  */
> +	{
...
> +	}
> +      else if (isless (abstheta, INFINITY))
> +	{
...
>  	}
> +      else
> +	{
> +	  int32_t ix;
> +	  /* High word of x.  */
> +	  GET_FLOAT_WORD (ix, abstheta);
> +	  /* Sin(Inf or NaN) is NaN.  */
> +	  if (ix == 0x7f800000)
> +	    __set_errno (EDOM);
> +	  return x - x;
> +	}
> +    }
>  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]