This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix ldbl-128 log1pl (-qNaN) spurious "invalid" exception (bug 19189) [committed]
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Thu, 29 Oct 2015 23:10:34 +0000
- Subject: Fix ldbl-128 log1pl (-qNaN) spurious "invalid" exception (bug 19189) [committed]
- Authentication-results: sourceware.org; auth=none
The ldbl-128 version of log1pl raises a spurious "invalid" exception
for a -qNaN argument. This patch fixes this by making the initial
check for infinities and NaNs handle arguments of both signs in such a
way that NaNs result in a NaN being returned (quietly if the input NaN
was quiet) while +Inf results in +Inf being returned and -Inf results
in a qNaN being returned with "invalid" exception raised.
Tested for mips64. Committed.
2015-10-29 Joseph Myers <joseph@codesourcery.com>
[BZ #19189]
* sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Make check for
non-finite argument handle arguments with negative sign.
diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
index 9806ab6..b348f41 100644
--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
+++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
@@ -130,8 +130,8 @@ __log1pl (long double xm1)
/* Test for NaN or infinity input. */
u.value = xm1;
hx = u.parts32.w0;
- if (hx >= 0x7fff0000)
- return xm1;
+ if ((hx & 0x7fffffff) >= 0x7fff0000)
+ return xm1 + fabsl (xm1);
/* log1p(+- 0) = +- 0. */
if (((hx & 0x7fffffff) == 0)
--
Joseph S. Myers
joseph@codesourcery.com