From patchwork Wed Feb 25 00:02:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 443272 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 7EA161400EA for ; Wed, 25 Feb 2015 11:02:38 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=Wij6N5yURduwioTNmx0v4IFeuh9Iw 3Gx3DZ6efXknlZJ8NzvGSvN3vonlLoeAgAyu9itqCh/SjgwYOA+ykok6sdnBipYx 84srJNTgHCEvksAws7+Cfi5s+hZdkdCjQQghkGNP3Yz5Fpwsi2V8GWxV7RCg07+O ZZnbcYuNWMTiP0= 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:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=zyZLcpSDViPNZYUb3bK8/5sxsV0=; b=Rtj 1os80IQUU7pPR1h4nv5YN08DfZu6cFi20dgo1AiAplU2wFkbtoH5pduX0xOhA3zL LUmElSi+P14/wjS1wCc02snYBWHSYyG/h81OzEp52AKCbz3qY2xrFls/JvZ1bD/Z LkErYoBCQcIuybL8LvZuYSoKhHCkYaY651lSSbVM= Received: (qmail 75011 invoked by alias); 25 Feb 2015 00:02:32 -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 75001 invoked by uid 89); 25 Feb 2015 00:02:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Wed, 25 Feb 2015 00:02:24 +0000 From: Joseph Myers To: Subject: Fix ldbl-128ibm acoshl inaccuracy (bug 18019) [committed] Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 The ldbl-128ibm implementation of acoshl uses a cut-off of 0x1p28 to determine when to use log(x) + log(2) as a formula. That cut-off is too small for this format, resulting in large errors. This patch changes it to a more appropriate cut-off of 0x1p56, adding tests around the cut-offs for various floating-point formats. Tested for powerpc. Also tested for x86_64 and x86 and updated ulps. Committed. (auto-libm-test-out diffs omitted below.) 2015-02-24 Joseph Myers [BZ #18019] * sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Use 2**56 not 2**28 as threshold for log (2x) formula. * math/auto-libm-test-in: Add more tests of acosh. * math/auto-libm-test-out: Regenerated. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index 62e1439..a4bd972 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -43,6 +43,37 @@ acosh 1.625 acosh 7 acosh 100 acosh 1e5 +acosh 0x1p8 +acosh 0x1p9 +acosh 0x1p10 +acosh 0x1p11 +acosh 0x1p12 +acosh 0x1p13 +acosh 0x1p24 +acosh 0x1p25 +acosh 0x1p26 +acosh 0x1p27 +acosh 0x1p28 +acosh 0x1p29 +acosh 0x1p30 +acosh 0x1p31 +acosh 0x1p32 +acosh 0x1p33 +acosh 0x1p48 +acosh 0x1p49 +acosh 0x1p50 +acosh 0x1p51 +acosh 0x1p52 +acosh 0x1p53 +acosh 0x1p54 +acosh 0x1p55 +acosh 0x1p56 +acosh 0x1p57 +acosh 0x1p58 +acosh 0x1p59 +acosh 0x1p100 +acosh 0x1p500 +acosh 0x1p5000 acosh max no-test-inline asin 0 diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 5e79307..0977557 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -21,6 +21,10 @@ Function: "acos_upward": ildouble: 1 ldouble: 1 +Function: "acosh": +ildouble: 1 +ldouble: 1 + Function: "acosh_downward": ildouble: 2 ldouble: 2 diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c index b0b33f7..cab1da9 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c @@ -44,14 +44,14 @@ __ieee754_acoshl(long double x) EXTRACT_WORDS64 (lx, xlo); if(hx<0x3ff0000000000000LL) { /* x < 1 */ return (x-x)/(x-x); - } else if(hx >=0x41b0000000000000LL) { /* x > 2**28 */ + } else if(hx >=0x4370000000000000LL) { /* x >= 2**56 */ if(hx >=0x7ff0000000000000LL) { /* x is inf of NaN */ return x+x; } else return __ieee754_logl(x)+ln2; /* acosh(huge)=log(2x) */ } else if (((hx-0x3ff0000000000000LL)|(lx&0x7fffffffffffffffLL))==0) { return 0.0; /* acosh(1) = 0 */ - } else if (hx > 0x4000000000000000LL) { /* 2**28 > x > 2 */ + } else if (hx > 0x4000000000000000LL) { /* 2**56 > x > 2 */ t=x*x; return __ieee754_logl(2.0*x-one/(x+__ieee754_sqrtl(t-one))); } else { /* 1