From patchwork Wed Jan 10 17:59:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 25330 Received: (qmail 72094 invoked by alias); 10 Jan 2018 17:59:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 72084 invoked by uid 89); 10 Jan 2018 17:59:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Wed, 10 Jan 2018 17:59:45 +0000 From: Joseph Myers To: Subject: Fix ldbl-128ibm log1pl (-qNaN) spurious "invalid" exception (bug 22693) [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) 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). Committed. 2018-01-10 Joseph Myers [BZ #22693] * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Handle negative arguments in test for NaN or infinity argument. diff --git a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c index 5457892..e499c9f 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)