From patchwork Fri Feb 10 19:28:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 726684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vKlNg2KY8z9s5g for ; Sat, 11 Feb 2017 06:28:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="IJ6LyzHX"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=Pkk43vum21CRuPPpgyfu33H3lrhQCzrQNU67RvpVTRLyb5cVMfue5 6Boq1SZNYS3TSagezK55swqmn0tVGrbz9Uec/dPuvw4/AyoM4KFbP8183Y30zfnF N15qnCWNgm34uLFQXTc6twujkUDmPafR1cvyIN32tsFV0KSB/B/bZY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=losbub184JmFPoR/AxeLsrGjvvI=; b=IJ6LyzHXv/4NSoINeyFviT3uffI7 9ZZ0AE2fkyec6PeR6XKFb9jxSzkfn60whfGr7zxeVpNeemweESgrNvOxBi5YVYM1 QvPMSl3RfGSKNFQi94++J5GZ2rr3kJmOJisWnvqfjwGp5srrDjGZuqvofz4YFiVu MY6cNHQOnUVwVQo= Received: (qmail 25246 invoked by alias); 10 Feb 2017 19:28:27 -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 25231 invoked by uid 89); 10 Feb 2017 19:28:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1752 X-HELO: mail.gftg.com.br From: "Gabriel F. T. Gomes" To: libc-alpha@sourceware.org Subject: [PATCH v2] [BZ 21130] ldbl-128: Fix y0 and y1 for -Inf input Date: Fri, 10 Feb 2017 17:28:15 -0200 Message-Id: <1486754895-29612-1-git-send-email-gftg@linux.vnet.ibm.com> The Bessel functions of the second type (Yn) are not defined for negative input and should return NAN with the "invalid" exception raised, in these cases. However, current code checks for infinity and return zero, regardless of the sign. This error is exposed for long double when linking with -lieee. Without this flag, the error is not exposed, because the wrappers for these functions, which use __kernel_standard functionality, return the correct value. Tested for powerpc64le. 2017-01-10 Gabriel F. T. Gomes [BZ 21130] * sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_y0l): Return NAN with the "invalid" exception raised when x is -Inf. * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): Likewise. --- sysdeps/ieee754/ldbl-128/e_j0l.c | 7 +------ sysdeps/ieee754/ldbl-128/e_j1l.c | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c index d711007..855b5a5 100644 --- a/sysdeps/ieee754/ldbl-128/e_j0l.c +++ b/sysdeps/ieee754/ldbl-128/e_j0l.c @@ -829,12 +829,7 @@ _Float128 _Float128 xx, xinv, z, p, q, c, s, cc, ss; if (! isfinite (x)) - { - if (x != x) - return x + x; - else - return 0; - } + return 1 / (x + x * x); if (x <= 0) { if (x < 0) diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c index 9e78230..db8dca0 100644 --- a/sysdeps/ieee754/ldbl-128/e_j1l.c +++ b/sysdeps/ieee754/ldbl-128/e_j1l.c @@ -847,12 +847,7 @@ __ieee754_y1l (_Float128 x) _Float128 xx, xinv, z, p, q, c, s, cc, ss; if (! isfinite (x)) - { - if (x != x) - return x + x; - else - return 0; - } + return 1 / (x + x * x); if (x <= 0) { if (x < 0)