summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-03 21:49:56 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-03 21:49:56 +0000
commit749008ff0361297af02b8574ac8848d35436eac3 (patch)
tree24d4078cb9fa9eb70e27a8c886301db8d09fadb1 /sysdeps/ieee754/dbl-64
parent17dea1887fcc116941e07cb0f5f2078140ab0384 (diff)
downloadglibc-749008ff0361297af02b8574ac8848d35436eac3.tar.gz
Fix exp missing underflows (bug 15268, bug 15425).
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_exp.c b/sysdeps/ieee754/dbl-64/e_exp.c
index df3aa5efaa..9d35e6d66c 100644
--- a/sysdeps/ieee754/dbl-64/e_exp.c
+++ b/sysdeps/ieee754/dbl-64/e_exp.c
@@ -39,6 +39,7 @@
#include "uexp.tbl"
#include <math_private.h>
#include <fenv.h>
+#include <float.h>
#ifndef SECTION
# define SECTION
@@ -169,7 +170,7 @@ __ieee754_exp (double x)
else
{
retval = __slowexp (x);
- goto ret;
+ goto check_uflow_ret;
} /*if error is over bound */
}
ex = -(1022 + ex);
@@ -185,13 +186,23 @@ __ieee754_exp (double x)
{
binexp.i[HIGH_HALF] = 0x00100000;
retval = (res - 1.0) * binexp.x;
- goto ret;
+ goto check_uflow_ret;
}
else
{
retval = __slowexp (x);
- goto ret;
+ goto check_uflow_ret;
} /* if error is over bound */
+ check_uflow_ret:
+ if (retval < DBL_MIN)
+ {
+#if FLT_EVAL_METHOD != 0
+ volatile
+#endif
+ double force_underflow = tiny * tiny;
+ math_force_eval (force_underflow);
+ }
+ goto ret;
}
else
{