summaryrefslogtreecommitdiff
path: root/math/w_tgammal.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-05 14:01:41 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-05 14:01:41 +0000
commite47cc4e0ed06f4167b6bd8ac39e12d094e0dc474 (patch)
tree1a1f08bd5751795b08e013f499f49df0830917fc /math/w_tgammal.c
parentbbf37bdc12c0370a0ac2fa597cddd660bad6ec5e (diff)
Fix tgamma errno setting on underflow (bug 6810).
Diffstat (limited to 'math/w_tgammal.c')
-rw-r--r--math/w_tgammal.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/math/w_tgammal.c b/math/w_tgammal.c
index 72b247db2a..4e2d66ae84 100644
--- a/math/w_tgammal.c
+++ b/math/w_tgammal.c
@@ -18,6 +18,7 @@
* Return the Gamma function of x.
*/
+#include <errno.h>
#include <math.h>
#include <math_private.h>
@@ -27,13 +28,15 @@ __tgammal(long double x)
int local_signgam;
long double y = __ieee754_gammal_r(x,&local_signgam);
- if(__builtin_expect(!__finitel(y), 0)
+ if(__glibc_unlikely (!__finitel (y) || y == 0)
&& (__finitel (x) || __isinfl (x) < 0)
&& _LIB_VERSION != _IEEE_) {
if(x==0.0)
return __kernel_standard_l(x,x,250); /* tgamma pole */
else if(__floorl(x)==x&&x<0.0L)
return __kernel_standard_l(x,x,241); /* tgamma domain */
+ else if (y == 0)
+ __set_errno (ERANGE); /* tgamma underflow */
else
return __kernel_standard_l(x,x,240); /* tgamma overflow */
}