Message ID | li8la8$llb$1@ger.gmane.org |
---|---|
State | Committed |
Headers |
Return-Path: <x14307373@homiemail-mx23.g.dreamhost.com> X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 01281360060 for <siddhesh@wilcox.dreamhost.com>; Fri, 11 Apr 2014 04:57:23 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14307373) id 91795628380AA; Fri, 11 Apr 2014 04:57:23 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx23.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-mx23.g.dreamhost.com (Postfix) with ESMTPS id 1AD36627CEB85 for <glibc@patchwork.siddhesh.in>; Fri, 11 Apr 2014 04:57:23 -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=OxEicLwcoQkrwj7m88wIP/LRQZIm+ 6cwHC6llu0EFlkSmXWdJP09gRLKSxsc8FCtQDo/u585TyOAe6qJrXplXRfrimzpb IM7KCDL+nS6HYJ81sodEqPrFtzATZl83b6ObGPb4KaNF0oHqBUC7I3iKh1DNgWUF xlXhrjDezDFhvs= 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=7BehzK7Vb+b19wsH0pi0S/2Ix+Y=; b=GyU xiQ0ck4ELYl0gCOch7TW6VbHH0VxuR3rHYxKnqxS6cIzOUCgRe42JVS+50XdqY+d 4hzV2saCqO0TgZNyD2B9qWDd3tuLKK40NuWWGp1w30PSpAT/m//GWTZJoTJo9AP5 Vn2JBg1HsmQyTtUID1UT50jXpHjZogVL0bNau2d0= Received: (qmail 16249 invoked by alias); 11 Apr 2014 11:57:13 -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 16165 invoked by uid 89); 11 Apr 2014 11:57:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 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 #16824] Fix failing y1 due to too large ulps in downward/upward rounding mode. Date: Fri, 11 Apr 2014 13:56:55 +0200 Lines: 50 Message-ID: <li8la8$llb$1@ger.gmane.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080103050503010204040706" 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 11, 2014, 11:56 a.m. UTC
Hi, on s390 the y1 tests for long double fails due to too large ulps in downward / upward rounding mode (See Bug 16824). According to Joseph Myers patch comment (https://sourceware.org/ml/libc-alpha/2014-03/msg00620.html), round-to-nearest is used internally to reduce error accumulation. Tests on s390/s390x shows following ulps: y1: 2 y1_downward: 4 y1_towardzero: 2 y1_upward: 5 Is this okay? On other architectures too? Bye --- 2014-04-11 Stefan Liebler <stli@linux.vnet.ibm.com> [BZ #16824] * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): Set round-to-nearest internally to reduce error accumulation. ---
Comments
On 11-04-2014 08:56, Stefan Liebler wrote: > Hi, > > on s390 the y1 tests for long double fails due to too large ulps in downward / upward rounding mode (See Bug 16824). > According to Joseph Myers patch comment > (https://sourceware.org/ml/libc-alpha/2014-03/msg00620.html), > round-to-nearest is used internally to reduce error accumulation. > Tests on s390/s390x shows following ulps: > y1: 2 > y1_downward: 4 > y1_towardzero: 2 > y1_upward: 5 > > Is this okay? On other architectures too? > > Bye > --- > 2014-04-11 Stefan Liebler <stli@linux.vnet.ibm.com> > > [BZ #16824] > * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): > Set round-to-nearest internally to reduce error accumulation. > --- > > diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c > index 70a1c86..db96c94 100644 > --- a/sysdeps/ieee754/ldbl-128/e_j1l.c > +++ b/sysdeps/ieee754/ldbl-128/e_j1l.c > @@ -855,11 +855,14 @@ __ieee754_y1l (long double x) > return -TWOOPI / x; > if (xx <= 2.0L) > { > + int save_round = fegetround (); > + libc_fesetround (FE_TONEAREST); > /* 0 <= x <= 2 */ > z = xx * xx; > p = xx * neval (z, Y0_2N, NY0_2N) / deval (z, Y0_2D, NY0_2D); > p = -TWOOPI / xx + p; > p = TWOOPI * __ieee754_logl (x) * __ieee754_j1l (x) + p; > + libc_fesetround (save_round); > return p; > } Although s390 does not implemented the optimization to set/restore rounding mode only when needed (check the x86_64 and powerpc fenv_private.h), the way to set/reset rounding mode should using SET_RESTORE_ROUND.
On Fri, Apr 11, 2014 at 01:56:55PM +0200, Stefan Liebler wrote: > Hi, > > on s390 the y1 tests for long double fails due to too large ulps in downward > / upward rounding mode (See Bug 16824). > According to Joseph Myers patch comment > (https://sourceware.org/ml/libc-alpha/2014-03/msg00620.html), > round-to-nearest is used internally to reduce error accumulation. > Tests on s390/s390x shows following ulps: > y1: 2 > y1_downward: 4 > y1_towardzero: 2 > y1_upward: 5 > > Is this okay? On other architectures too? > > Bye > --- > 2014-04-11 Stefan Liebler <stli@linux.vnet.ibm.com> > > [BZ #16824] > * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_y1l): > Set round-to-nearest internally to reduce error accumulation. > --- > > diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c > index 70a1c86..db96c94 100644 > --- a/sysdeps/ieee754/ldbl-128/e_j1l.c > +++ b/sysdeps/ieee754/ldbl-128/e_j1l.c > @@ -855,11 +855,14 @@ __ieee754_y1l (long double x) > return -TWOOPI / x; > if (xx <= 2.0L) > { > + int save_round = fegetround (); > + libc_fesetround (FE_TONEAREST); You'll find that the SET_RESTORE_ROUND macro would be a better fit here since it does a save/restore only when needed. Besides it makes code more consistent with other functions. Siddhesh. > /* 0 <= x <= 2 */ > z = xx * xx; > p = xx * neval (z, Y0_2N, NY0_2N) / deval (z, Y0_2D, NY0_2D); > p = -TWOOPI / xx + p; > p = TWOOPI * __ieee754_logl (x) * __ieee754_j1l (x) + p; > + libc_fesetround (save_round); > return p; > } > >
diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c index 70a1c86..db96c94 100644 --- a/sysdeps/ieee754/ldbl-128/e_j1l.c +++ b/sysdeps/ieee754/ldbl-128/e_j1l.c @@ -855,11 +855,14 @@ __ieee754_y1l (long double x) return -TWOOPI / x; if (xx <= 2.0L) { + int save_round = fegetround (); + libc_fesetround (FE_TONEAREST); /* 0 <= x <= 2 */ z = xx * xx; p = xx * neval (z, Y0_2N, NY0_2N) / deval (z, Y0_2D, NY0_2D); p = -TWOOPI / xx + p; p = TWOOPI * __ieee754_logl (x) * __ieee754_j1l (x) + p; + libc_fesetround (save_round); return p; }