diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-12-03 21:49:56 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-12-03 21:49:56 +0000 |
commit | 749008ff0361297af02b8574ac8848d35436eac3 (patch) | |
tree | 24d4078cb9fa9eb70e27a8c886301db8d09fadb1 /sysdeps | |
parent | 17dea1887fcc116941e07cb0f5f2078140ab0384 (diff) | |
download | glibc-749008ff0361297af02b8574ac8848d35436eac3.tar.gz glibc-749008ff0361297af02b8574ac8848d35436eac3.tar.xz glibc-749008ff0361297af02b8574ac8848d35436eac3.zip |
Fix exp missing underflows (bug 15268, bug 15425).
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/fpu/libm-test-ulps | 32 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_exp.c | 17 | ||||
-rw-r--r-- | sysdeps/x86_64/fpu/libm-test-ulps | 52 |
3 files changed, 98 insertions, 3 deletions
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index a492da30d6..4ed02a2797 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -6017,6 +6017,30 @@ ildouble: 1 ldouble: 1 # exp_towardzero +Test "exp_towardzero (-0x2.e870a4p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a7e5e88c1f0cp+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a7e5e88c1f1p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a7e5e88c2p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a7e5e88cp+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a8p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.ebe224p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.ebe228p+8)": +ildouble: 1 +ldouble: 1 Test "exp_towardzero (0x2.c5cp+8)": double: 1 idouble: 1 @@ -6047,6 +6071,12 @@ ildouble: 1 ldouble: 1 # exp_upward +Test "exp_upward (-0x2.e870a7e5e88c1f0cp+8)": +ildouble: 1 +ldouble: 1 +Test "exp_upward (-0x2.e870a7e5e88cp+8)": +ildouble: 1 +ldouble: 1 Test "exp_upward (1)": double: 1 float: 1 @@ -8112,6 +8142,8 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: "expm1": ildouble: 1 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 { diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps index 5c923e69b3..e78514869d 100644 --- a/sysdeps/x86_64/fpu/libm-test-ulps +++ b/sysdeps/x86_64/fpu/libm-test-ulps @@ -6882,6 +6882,30 @@ ildouble: 1 ldouble: 1 # exp_towardzero +Test "exp_towardzero (-0x2.e870a4p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a7e5e88c1f0cp+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a7e5e88c1f1p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a7e5e88c2p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a7e5e88cp+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.e870a8p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.ebe224p+8)": +ildouble: 1 +ldouble: 1 +Test "exp_towardzero (-0x2.ebe228p+8)": +ildouble: 1 +ldouble: 1 Test "exp_towardzero (0x2.c5cp+8)": ildouble: 1 ldouble: 1 @@ -6917,6 +6941,32 @@ ildouble: 1 ldouble: 1 # exp_upward +Test "exp_upward (-0x2.e870a4p+8)": +double: 1 +idouble: 1 +Test "exp_upward (-0x2.e870a7e5e88c1f0cp+8)": +ildouble: 1 +ldouble: 1 +Test "exp_upward (-0x2.e870a7e5e88c2p+8)": +double: 1 +idouble: 1 +Test "exp_upward (-0x2.e870a7e5e88cp+8)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "exp_upward (-0x2.e870a8p+8)": +double: 1 +idouble: 1 +Test "exp_upward (-0x2.ebe224p+8)": +double: 1 +idouble: 1 +Test "exp_upward (-0x2.ebe227861639p+8)": +double: 1 +idouble: 1 +Test "exp_upward (-0x2.ebe228p+8)": +double: 1 +idouble: 1 Test "exp_upward (-0x4.d2p+8)": double: 1 idouble: 1 @@ -9208,6 +9258,8 @@ double: 1 float: 1 idouble: 1 ifloat: 1 +ildouble: 1 +ldouble: 1 Function: "expm1": double: 1 |