This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv6] New generic sinf
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Rajalakshmi Srinivasaraghavan <raji at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org
- Cc: nd at arm dot com
- Date: Tue, 05 Dec 2017 17:23:19 +0000
- Subject: Re: [PATCHv6] New generic sinf
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- References: <1512033760-18792-1-git-send-email-raji@linux.vnet.ibm.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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;
> + }
> + }
> }