From patchwork Fri Apr 11 11:56:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 502 Return-Path: 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 ; 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 ; 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: 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 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 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: Mime-Version: 1.0 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 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 [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; }