[PATCHv6] New generic sinf
Szabolcs Nagy
szabolcs.nagy@arm.com
Tue Dec 5 17:23:00 GMT 2017
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;
> + }
> + }
> }
More information about the Libc-alpha
mailing list