This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] fix sinf(NAN)
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>, Joseph Myers <joseph at codesourcery dot com>, Rajalakshmi Srinivasaraghavan <raji at linux dot vnet dot ibm dot com>
- Cc: nd at arm dot com
- Date: Tue, 05 Dec 2017 18:05:04 +0000
- Subject: [PATCH] fix sinf(NAN)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
sinf(NAN) should not signal invalid fp exception
so use isless instead of < where NAN is compared.
this makes the sinf tests pass on aarch64.
2017-12-05 Szabolcs Nagy <szabolcs.nagy@arm.com>
* sysdeps/ieee754/flt-32/s_sinf.c (sinf): Use isless.
diff --git a/sysdeps/ieee754/flt-32/s_sinf.c b/sysdeps/ieee754/flt-32/s_sinf.c
index 40d3d197a8..db1b5a18cb 100644
--- a/sysdeps/ieee754/flt-32/s_sinf.c
+++ b/sysdeps/ieee754/flt-32/s_sinf.c
@@ -128,7 +128,7 @@ SINF_FUNC (float x)
double theta = x;
double abstheta = fabs (theta);
/* If |x|< Pi/4. */
- if (abstheta < M_PI_4)
+ if (isless (abstheta, M_PI_4))
{
if (abstheta >= 0x1p-5) /* |x| >= 2^-5. */
{
@@ -162,8 +162,8 @@ SINF_FUNC (float x)
}
else /* |x| >= Pi/4. */
{
- unsigned int signbit = (x < 0);
- if (abstheta < 9 * M_PI_4) /* |x| < 9*Pi/4. */
+ unsigned int signbit = isless (x, 0);
+ if (isless (abstheta, 9 * M_PI_4)) /* |x| < 9*Pi/4. */
{
/* There are cases where FE_UPWARD rounding mode can
produce a result of abstheta * inv_PI_4 == 9,