From eb3fc44b56e5e780be5e2830c72d20b9e74fef8a Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 6 Jan 2014 18:20:20 +0000 Subject: Fix ldbl-128 / ldbl-128ibm lgammal spurious underflow (bug 16400). This patch fixes bug 16400, spurious underflow exceptions for ldbl-128 / ldbl-128ibm lgammal with small positive arguments, by just using -__logl (x) as the result in the problem cases (similar to the previous fix for problems with small negative arguments). Tested powerpc32, and also tested on mips64 that this does not require ulps regeneration for the ldbl-128 case. * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r): Return -__logl (x) for small positive arguments without evaluating a polynomial. --- sysdeps/ieee754/ldbl-128/e_lgammal_r.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sysdeps/ieee754') diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c index 23ab9b9a43..1961355a73 100644 --- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c +++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c @@ -805,7 +805,9 @@ __ieee754_lgammal_r (long double x, int *signgamp) { case 0: /* log gamma (x + 1) = log(x) + log gamma(x) */ - if (x <= 0.125) + if (x < 0x1p-120L) + return -__logl (x); + else if (x <= 0.125) { p = x * neval (x, RN1, NRN1) / deval (x, RD1, NRD1); } -- cgit 1.4.1