about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-01-06 18:20:20 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-01-06 18:20:20 +0000
commiteb3fc44b56e5e780be5e2830c72d20b9e74fef8a (patch)
tree77225ddae4384596a6c9e46ae8340ee9e2698032
parent5fd3eccbea76216091e147ebd84ed64a839f76eb (diff)
downloadglibc-eb3fc44b56e5e780be5e2830c72d20b9e74fef8a.tar.gz
glibc-eb3fc44b56e5e780be5e2830c72d20b9e74fef8a.tar.xz
glibc-eb3fc44b56e5e780be5e2830c72d20b9e74fef8a.zip
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.
-rw-r--r--ChangeLog7
-rw-r--r--NEWS2
-rw-r--r--sysdeps/ieee754/ldbl-128/e_lgammal_r.c4
3 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1984691a78..8bdea17179 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-01-06  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #16400]
+	* sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r):
+	Return -__logl (x) for small positive arguments without evaluating
+	a polynomial.
+
 2014-01-06  Mike Frysinger  <vapier@gentoo.org>
 
 	* sysdeps/unix/sysv/linux/sys/ptrace.h (ptrace_peeksiginfo_args):
diff --git a/NEWS b/NEWS
index e6c5020a07..ab3b882631 100644
--- a/NEWS
+++ b/NEWS
@@ -24,7 +24,7 @@ Version 2.19
   16112, 16143, 16144, 16146, 16150, 16151, 16153, 16167, 16172, 16195,
   16214, 16245, 16271, 16274, 16283, 16289, 16293, 16314, 16316, 16330,
   16337, 16338, 16356, 16365, 16366, 16369, 16372, 16375, 16379, 16384,
-  16385, 16386, 16390.
+  16385, 16386, 16390, 16400.
 
 * Slovenian translations for glibc messages have been contributed by the
   Translation Project's Slovenian team of translators.
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);
 	    }