From b303185df9b4f3d097956fe566a32aed4f85b127 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 10 Jan 2018 17:59:01 +0000 Subject: Fix ldbl-128ibm log1pl (-qNaN) spurious "invalid" exception (bug 22693). The ldbl-128ibm implementation of log1pl does ordered comparisons on a negative qNaN argument, so resulting in spurious "invalid" exceptions (for soft-float powerpc; hard-float only avoids this because of GCC bug 58684 meaning ordered comparison instructions never get generated). This patch fixes this by arranging for the test for NaN or infinity arguments to handle negative arguments as well. Tested for powerpc (soft float). [BZ #22693] * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Handle negative arguments in test for NaN or infinity argument. --- sysdeps/ieee754/ldbl-128ibm/s_log1pl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sysdeps/ieee754') diff --git a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c index 5457892a98..e499c9f604 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c @@ -131,8 +131,8 @@ __log1pl (long double xm1) /* Test for NaN or infinity input. */ xhi = ldbl_high (xm1); EXTRACT_WORDS (hx, lx, xhi); - if (hx >= 0x7ff00000) - return xm1 + xm1; + if ((hx & 0x7fffffff) >= 0x7ff00000) + return xm1 + xm1 * xm1; /* log1p(+- 0) = +- 0. */ if (((hx & 0x7fffffff) | lx) == 0) -- cgit v1.2.3