From 0f0cf7ec49719ab3c357813689bf1095234d6533 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 10 Jun 2010 22:20:17 +0200 Subject: lgamma: fix sign handling add testcase from http://sourceware.org/bugzilla/show_bug.cgi?id=4407 Signed-off-by: Bernhard Reutner-Fischer --- libm/e_lgamma_r.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libm') diff --git a/libm/e_lgamma_r.c b/libm/e_lgamma_r.c index 2b1fde78c..23c96d808 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; -- cgit v1.2.3