summaryrefslogtreecommitdiff
path: root/libm/e_lgamma_r.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-06-10 20:20:17 (GMT)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-06-10 20:23:54 (GMT)
commit0f0cf7ec49719ab3c357813689bf1095234d6533 (patch)
treea696368bfa111461e2501fceb0bb43dea5170aac /libm/e_lgamma_r.c
parent0671149ee68ee76d357c6dade14249fc9858d934 (diff)
lgamma: fix sign handling
add testcase from http://sourceware.org/bugzilla/show_bug.cgi?id=4407 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libm/e_lgamma_r.c')
-rw-r--r--libm/e_lgamma_r.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libm/e_lgamma_r.c b/libm/e_lgamma_r.c
index 2b1fde7..23c96d8 100644
--- a/libm/e_lgamma_r.c
+++ b/libm/e_lgamma_r.c
@@ -208,7 +208,11 @@ double attribute_hidden __ieee754_lgamma_r(double x, int *signgamp)
*signgamp = 1;
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) return x*x;
- if((ix|lx)==0) return one/zero;
+ if((ix|lx)==0) {
+ if (__signbitl(x))
+ *signgamp = -1;
+ return one/zero;
+ }
if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */
if(hx<0) {
*signgamp = -1;