]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
[PATCH] fix sinf(NAN)
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 5 Dec 2017 18:09:22 +0000 (18:09 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 5 Dec 2017 18:09:22 +0000 (18:09 +0000)
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.

* sysdeps/ieee754/flt-32/s_sinf.c (sinf): Use isless.

ChangeLog
sysdeps/ieee754/flt-32/s_sinf.c

index bcc49a1dc52e2686e09231b463b176a1905244e4..15da4e7937ec9973fdd23e0b6a858e5060cf3e9f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-12-05  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * sysdeps/ieee754/flt-32/s_sinf.c (sinf): Use isless.
+
 2017-12-05  Joseph Myers  <joseph@codesourcery.com>
 
        * stdlib/strfromd.c: Include <bits/floatn.h>.
index 0b76477d227995408774bd68841a87ef0dba2f06..8b98573ae476013f7264d8b09f86e126ccb9dde5 100644 (file)
@@ -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,