about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/e_pow.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-04-09 09:43:18 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-04-09 09:43:18 +0000
commitd7dd94539899466a9a4e38c61ab846ffcb314dad (patch)
tree30a319648bb4afe4e4296d2e77cb7bbf8084893d /sysdeps/ieee754/dbl-64/e_pow.c
parentc483f6b4a4277bc209820efc1ae35d976af57b4e (diff)
downloadglibc-d7dd94539899466a9a4e38c61ab846ffcb314dad.tar.gz
glibc-d7dd94539899466a9a4e38c61ab846ffcb314dad.tar.xz
glibc-d7dd94539899466a9a4e38c61ab846ffcb314dad.zip
Fix missing overflow exceptions from pow (bug 13873).
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_pow.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_pow.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index 26ffaaddc6..6c41af93ba 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -47,6 +47,7 @@
 # define SECTION
 #endif
 
+static const double huge = 1.0e300, tiny = 1.0e-300;
 
 double __exp1(double x, double xx, double error);
 static double log1(double x, double *delta, double *error);
@@ -156,8 +157,8 @@ __ieee754_pow(double x, double y) {
 
   if (qy > 0x45f00000 && qy < 0x7ff00000) {
     if (x == 1.0) return 1.0;
-    if (y>0) return (x>1.0)?INF.x:0;
-    if (y<0) return (x<1.0)?INF.x:0;
+    if (y>0) return (x>1.0)?huge*huge:tiny*tiny;
+    if (y<0) return (x<1.0)?huge*huge:tiny*tiny;
   }
 
   if (x == 1.0) return 1.0;