diff options
Diffstat (limited to 'libquadmath/math/lgammaq.c')
-rw-r--r-- | libquadmath/math/lgammaq.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libquadmath/math/lgammaq.c b/libquadmath/math/lgammaq.c index 6e7697a..361f703 100644 --- a/libquadmath/math/lgammaq.c +++ b/libquadmath/math/lgammaq.c @@ -18,7 +18,7 @@ * Returns the base e (2.718...) logarithm of the absolute * value of the gamma function of the argument. * The sign (+1 or -1) of the gamma function is returned in a - * global (extern) variable named sgngam. + * global (extern) variable named signgam. * * The positive domain is partitioned into numerous segments for approximation. * For x > 10, @@ -69,6 +69,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "quadmath-imp.h" +#include <math.h> /* For extern int signgam. */ static const __float128 PIQ = 3.1415926535897932384626433832795028841972E0Q; static const __float128 MAXLGM = 1.0485738685148938358098967157129705071571E4928Q; @@ -757,9 +758,8 @@ __float128 lgammaq (__float128 x) { __float128 p, q, w, z, nx; - int i, nn, sign; - - sign = 1; + int i, nn; + int sign; if (! finiteq (x)) return x * x; @@ -767,9 +767,11 @@ lgammaq (__float128 x) if (x == 0.0Q) { if (signbitq (x)) - sign = -1; + sign = -1; } + signgam = sign; + if (x < 0.0Q) { q = -x; @@ -788,6 +790,8 @@ lgammaq (__float128 x) z = p - q; } z = q * sinq (PIQ * z); + signgam = sign; + if (z == 0.0Q) return (sign * huge * huge); w = lgammaq (q); @@ -855,7 +859,7 @@ lgammaq (__float128 x) { z = x - 0.75Q; p = z * neval (z, RN1r75, NRN1r75) - / deval (z, RD1r75, NRD1r75); + / deval (z, RD1r75, NRD1r75); p += lgam1r75b; p += lgam1r75a; } |