about summary refs log tree commit diff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2012-06-01 10:10:18 -0300
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2012-06-01 10:10:18 -0300
commit73a68f94d650ac485db6b95242e1cb6591b193d3 (patch)
treefb07542aa7411ef1ddbf8d213521d72e208b370c /sysdeps/powerpc
parentebc64a18c07742ebb85d7ddeca376995c0e67593 (diff)
downloadglibc-73a68f94d650ac485db6b95242e1cb6591b193d3.tar.gz
glibc-73a68f94d650ac485db6b95242e1cb6591b193d3.tar.xz
glibc-73a68f94d650ac485db6b95242e1cb6591b193d3.zip
PowerPC: Fix for POWER7 sinf/cosf
This patch fixes some sinf/cosf calculations that generated unexpected
underflows exceptions.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/fpu/k_cosf.c5
-rw-r--r--sysdeps/powerpc/fpu/k_sinf.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sysdeps/powerpc/fpu/k_cosf.c b/sysdeps/powerpc/fpu/k_cosf.c
index e2571d6802..d5668e3127 100644
--- a/sysdeps/powerpc/fpu/k_cosf.c
+++ b/sysdeps/powerpc/fpu/k_cosf.c
@@ -18,6 +18,7 @@
    not, see <http://www.gnu.org/licenses/>.  */
 
 #include <math.h>
+#include <fenv.h>
 #include <math_private.h>
 
 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 ab4561e65e..c8fb8ef81c 100644
--- a/sysdeps/powerpc/fpu/k_sinf.c
+++ b/sysdeps/powerpc/fpu/k_sinf.c
@@ -18,6 +18,7 @@
    not, see <http://www.gnu.org/licenses/>.  */
 
 #include <math.h>
+#include <fenv.h>
 #include <math_private.h>
 
 
@@ -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;