From: Adhemerval Zanella Date: Fri, 1 Jun 2012 13:10:18 +0000 (-0300) Subject: PowerPC: Fix for POWER7 sinf/cosf X-Git-Tag: glibc-2.16-tps~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73a68f94d650ac485db6b95242e1cb6591b193d3;p=thirdparty%2Fglibc.git PowerPC: Fix for POWER7 sinf/cosf This patch fixes some sinf/cosf calculations that generated unexpected underflows exceptions. --- diff --git a/ChangeLog b/ChangeLog index 6cb9f2d30dd..009e75ed17c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-06-01 Adhemerval Zanella + + * sysdeps/powerpc/fpu/k_cosf.c: Fix underflow generation. + * sysdeps/powerpc/fpu/k_sinf.c: Likewise. + 2012-05-31 H.J. Lu [BZ #14117] diff --git a/sysdeps/powerpc/fpu/k_cosf.c b/sysdeps/powerpc/fpu/k_cosf.c index e2571d6802d..d5668e31274 100644 --- a/sysdeps/powerpc/fpu/k_cosf.c +++ b/sysdeps/powerpc/fpu/k_cosf.c @@ -18,6 +18,7 @@ not, see . */ #include +#include #include static const float twom27 = 7.4505806e-09; @@ -40,8 +41,8 @@ __kernel_cosf (float x, float y) ix = __builtin_fabsf (x); if (ix < twom27) { /* |x| < 2**-27 */ - if (x == 0.0) - return one; + __feraiseexcept (FE_INEXACT); + return one; } z = x * x; r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6))))); diff --git a/sysdeps/powerpc/fpu/k_sinf.c b/sysdeps/powerpc/fpu/k_sinf.c index ab4561e65ea..c8fb8ef81ce 100644 --- a/sysdeps/powerpc/fpu/k_sinf.c +++ b/sysdeps/powerpc/fpu/k_sinf.c @@ -18,6 +18,7 @@ not, see . */ #include +#include #include @@ -39,8 +40,8 @@ __kernel_sinf (float x, float y, int iy) ix = __builtin_fabsf (x); if (ix < twom27) { /* |x| < 2**-27 */ - if (x == 0.0) - return x; + __feraiseexcept (FE_INEXACT); + return x; } z = x * x; v = z * x;