Message ID | li3hm5$hus$1@ger.gmane.org |
---|---|
State | Committed |
Headers |
Return-Path: <x14307373@homiemail-mx20.g.dreamhost.com> X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx20.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 7BE50360068 for <siddhesh@wilcox.dreamhost.com>; Wed, 9 Apr 2014 06:24:43 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14307373) id 2C7CE414CB6B6; Wed, 9 Apr 2014 06:24:43 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx20.g.dreamhost.com 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 homiemail-mx20.g.dreamhost.com (Postfix) with ESMTPS id F0B12416F506C for <glibc@patchwork.siddhesh.in>; Wed, 9 Apr 2014 06:24:42 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=UihQtdvwyqb7oXhm6fYT8Xm7r9kIN viXJGq3DtXG65J+VpvmY5Zcq7ebxvFXcSYU7f66Se8jmdhuddiLFq2+mDRzQXRiH QyQOiJvTEw9jhKdxFhkx2NF4i4h/s+zCqduYhKqSjkyRh7E0NrJOrN8d467H8lTr HJ4ODjmK8c192Y= 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:to:from:subject:date:message-id:mime-version :content-type; s=default; bh=uw2zcHdZtBBdzBKMuvD8p6RMGAw=; b=gUa Q5V3OD3LPan0Fz5SYrLYX7wyqc4mGv2HWH5kNlBL6krGTNJqDO/oaR9xIaqktqMX vNQtIj/4Q6TVSqibly22QXY80ezm/RSmHR/MTYitJvxlyJ8nA8rtRUWELgcb/InW G4E+scX5Q6JaYfoiaoaKSgPG2WCxek7bp71ugqqk= Received: (qmail 23224 invoked by alias); 9 Apr 2014 13:24:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-glibc=patchwork.siddhesh.in@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23206 invoked by uid 89); 9 Apr 2014 13:24:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler <stli@linux.vnet.ibm.com> Subject: [PATCH][BZ #16823] S390: Fix log1pl returning wrong infinity sign Date: Wed, 09 Apr 2014 15:24:21 +0200 Lines: 52 Message-ID: <li3hm5$hus$1@ger.gmane.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020700070103040006020707" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 X-DH-Original-To: glibc@patchwork.siddhesh.in |
Commit Message
Stefan Liebler
April 9, 2014, 1:24 p.m. UTC
Hi, on S390 test-double fails for log1pl(-1) with infinity has wrong sign in rounding mode FE_DOWNWARD. See Bug 16823. In this rounding mode, (x-x) = -0. In all other rounding modes, (x-x) = +0. A division with divisor -0 leads to +inf, while +0 results in -inf as expected. This patch changes the divisor to a const +0. Tested on s390/s390x. Is this okay? Bye --- 2014-04-09 Stefan Liebler <stli@linux.vnet.ibm.com> [BZ #16823] * sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Use const positive zero instead of (x-x). ---
Comments
On Wed, Apr 09, 2014 at 03:24:21PM +0200, Stefan Liebler wrote: > Hi, > > on S390 test-double fails for log1pl(-1) with infinity has wrong > sign in rounding mode FE_DOWNWARD. See Bug 16823. > In this rounding mode, (x-x) = -0. > In all other rounding modes, (x-x) = +0. > A division with divisor -0 leads to +inf, while +0 results in -inf > as expected. This patch changes the divisor to a const +0. > Tested on s390/s390x. > > Is this okay? > Looks ok. Perhaps we could add constants for infinity and nan would to write return value directly.
On 04/10/2014 12:09 AM, Ondřej Bílka wrote: > On Wed, Apr 09, 2014 at 03:24:21PM +0200, Stefan Liebler wrote: >> Hi, >> >> on S390 test-double fails for log1pl(-1) with infinity has wrong >> sign in rounding mode FE_DOWNWARD. See Bug 16823. >> In this rounding mode, (x-x) = -0. >> In all other rounding modes, (x-x) = +0. >> A division with divisor -0 leads to +inf, while +0 results in -inf >> as expected. This patch changes the divisor to a const +0. >> Tested on s390/s390x. >> >> Is this okay? >> > Looks ok. > > Perhaps we could add constants for infinity and nan would to write > return value directly. > Thanks. Returning a constant of infinity is not enough. In this case an divide by zero exception should be raised, because log(0) is not defined.
diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c index d991e8a..6c1970b 100644 --- a/sysdeps/ieee754/ldbl-128/s_log1pl.c +++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c @@ -150,9 +150,9 @@ __log1pl (long double xm1) if (x <= 0.0L) { if (x == 0.0L) - return (-1.0L / (x - x)); + return (-1.0L / zero); else - return (zero / (x - x)); + return (zero / zero); } /* Separate mantissa from exponent. */