This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix ldbl-128ibm logl (1) sign of zero result (bug 19077)


The ldbl-128ibm implementation of logl produces a zero with the wrong
sign for logl (1) in FE_DOWNWARD mode.  This patch makes it explicitly
return 0.0L in that case, as in e.g. the ldbl-128 implementation.

Tested for powerpc.

2015-10-06  Joseph Myers  <joseph@codesourcery.com>

	[BZ #19077]
	* sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): Return
	0.0L for argument 1.0L.

diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
index 58d6bc6..dcac380 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_logl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
@@ -219,6 +219,8 @@ __ieee754_logl(long double x)
   /* On this interval the table is not used due to cancellation error.  */
   if ((x <= 1.0078125L) && (x >= 0.9921875L))
     {
+      if (x == 1.0L)
+	return 0.0L;
       z = x - 1.0L;
       k = 64;
       t = 1.0L;

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]