From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2083.outbound.protection.outlook.com [40.107.20.83]) by sourceware.org (Postfix) with ESMTPS id CE00B3846402 for ; Thu, 7 Jan 2021 19:26:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CE00B3846402 Received: from AM6P194CA0082.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:8f::23) by DB7PR08MB3724.eurprd08.prod.outlook.com (2603:10a6:10:30::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.23; Thu, 7 Jan 2021 19:26:45 +0000 Received: from VE1EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8f:cafe::1f) by AM6P194CA0082.outlook.office365.com (2603:10a6:209:8f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 19:26:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT054.mail.protection.outlook.com (10.152.19.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6 via Frontend Transport; Thu, 7 Jan 2021 19:26:44 +0000 Received: ("Tessian outbound 6ec21dac9dd3:v71"); Thu, 07 Jan 2021 19:26:44 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a1b1c28b65d716f6 X-CR-MTA-TID: 64aa7808 Received: from bdbc4ce1c7b0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3978059B-4EFB-4F62-A570-C26977931047.1; Thu, 07 Jan 2021 19:26:38 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bdbc4ce1c7b0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Jan 2021 19:26:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4db9rJdy2diaMbKxKRdIU5CnWZ0UucBa1ZBwxmM93UaVz75+f2qI4KCnw38vAXH037Ltoy/7ilbtdsbZFvkH32tBfzpaoRsUUHLrdWOh88Hz0rz9qZgzvBy1Cv/cSM5Ic4a/4Km4ghWAbqoFTlRn/Hj4PiV3swK78sob49CBA+HO8Au6MsZucuLNHl4TZBlXwle9/vSyXmg27jglYTu9fzcedIWn7cyUs1GH+IMPIijQlFZyzrmi/tQpVcRhXxYineoq197ufpJS6sbLFyLrjNTvIj6lRw6/bLfjAGV5nowUdSapRhoJ9Wtv7q8qNtEQiVzw+wDcSBCbcwTmJ4WTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NKPoCO+3hIWTWCnk+IrNkXMR45zZfiUG6bK/bLjpVMg=; b=nYFa55cYFc9LaJ67sx/7pKwlBmNulQSgpoMXXSlxaONFO9dY6nyMuwDdQ35RftbIUVpsDrtZ/hbdXyKfKGo+v4g5FNi0TOxkgRmx85Q+rAz+9NItyxq83Cf/DTkxEw66KODsngPoBUC9aAZsk2kk2QJgQCRD8L0qRb1hyMRaSCNEgmYmSui9XVc0AAdYuT2B/77030JUf/3WAKySSVh2SRlyV66/siEggYVnfpC9DUqnLOIxBbT1Oy9uuR8IpvJBUAgSKer2WE6GQCmd9PGdTi0uWbHOlTar7bEQdR1QCjnF9GyNh1N8HcE7o5kQycajCZgz/6+sj0z2RBuM3TIjkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from VE1PR08MB5599.eurprd08.prod.outlook.com (2603:10a6:800:1a1::12) by VI1PR0801MB1760.eurprd08.prod.outlook.com (2603:10a6:800:51::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.21; Thu, 7 Jan 2021 19:26:37 +0000 Received: from VE1PR08MB5599.eurprd08.prod.outlook.com ([fe80::6d00:2694:e0d7:986f]) by VE1PR08MB5599.eurprd08.prod.outlook.com ([fe80::6d00:2694:e0d7:986f%5]) with mapi id 15.20.3742.006; Thu, 7 Jan 2021 19:26:37 +0000 From: Wilco Dijkstra To: 'GNU C Library' Subject: [PATCH v2 3/5] Remove slow paths from atan Thread-Topic: [PATCH v2 3/5] Remove slow paths from atan Thread-Index: AQHW5SsEizF7pJN/PUu/xPvcJtc43A== Date: Thu, 7 Jan 2021 19:26:37 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; x-originating-ip: [82.24.249.100] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8ad3f996-b8b4-4759-17ae-08d8b3422b34 x-ms-traffictypediagnostic: VI1PR0801MB1760:|DB7PR08MB3724: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:167;OLM:167; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: xeN1MUBcz52TGwTTuo6PhOBiwez56LS8m8RFB5jZ6B3CAl159R6Bta7ZbF4LnKm710YqS3wNcIwC3z1HlvK5KcT4eva6hBoe4Ta0AfGU63/CzG7JOY4YeQZ3dh9XcAEeHuUHTRc1uW2CG+oflgApZvOa+jndQINtwpLhLbqf9phEpz29wKsmWwTXpaz2GHYrmqqPRyni7yVheXHTHKv9o38rtld0x7x+KrjTsoVbge2/Q8m3rfyPN7xaABryulMui6TZFAb4Fym/zAJwkc2Uf8KHaTCqTHXUi+WWaPpKn/l1aek1WezHLBYCwCFm8CxPiHxH+s46mlhLchIHJVcZcG6B5MUxx1iPs+kxKHdOzke3Ry96ZiNy4D5wDMdiZLTW X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB5599.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(346002)(376002)(366004)(39860400002)(83380400001)(6916009)(7696005)(26005)(33656002)(478600001)(55016002)(316002)(71200400001)(8936002)(5660300002)(6506007)(9686003)(76116006)(86362001)(8676002)(186003)(66446008)(2906002)(66946007)(66556008)(64756008)(66476007)(52536014); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?7dQN7cxDANY92L/Sl9p31DwD+qP7n02cZMC7ha2oHQzEUkuYhLlRFQl5VL?= =?iso-8859-1?Q?6Y4dxG/iaYPIRC/WafoTt/0HJRC6XiOsnj2GUDbGpWKTmSoT7C2k4/aOG6?= =?iso-8859-1?Q?OF+HgFO+BFgYzPz1BzMcRrRljlKKsk6TQQOm371oAJLUFc0CINypITnLoV?= =?iso-8859-1?Q?gvpmeJCmwsXPMaIBzeaQAqUP7EBnvuSw+9CxVRU4EeSrWw8Mg8BTkav9QL?= =?iso-8859-1?Q?iJqfw2AI/DN0m7mSecSLGFMhkcX38PSqICggMN6EIHBPqW9Gdqe7sIxE+s?= =?iso-8859-1?Q?IMoQxNjLAi2luYtJ4T/4XxMeWr07zuGG/CKgyIkZu6D+Bx83uNvciTf4uj?= =?iso-8859-1?Q?1G13C/ATl1HZqvzFidLtJg/5GddH+fmOK1zAOm3cFEmGKsDhlGXA8xHNSY?= =?iso-8859-1?Q?+OrOMoFez3ntSC8JazqMqDOj+5Q5ZpXFbdVVUx/YLVVR/yPGcdjJPuVV2l?= =?iso-8859-1?Q?AQhLW60CG7zBiHEZ+tQlNkrmybC+u8kuyzqrOHhk+EzJhYl78avyOLPX50?= =?iso-8859-1?Q?EYVlNv+og7lvCvNPLttUrbHYN4tXYuPWxy27APiLUO59nPXV2M0BG9X4cu?= =?iso-8859-1?Q?zRhcD5b3g+7H/thsNV5Fv9BYQYpM6suKksYDt7WjX3sZYM37NUM4TquDcM?= =?iso-8859-1?Q?al9gcNUszbUd/NjvFtKvMj2qgusJT5XzEXhlhC3BYyHhrbtceoRpSraNYY?= =?iso-8859-1?Q?48XIn/aQLyT62KnOkNbZH+l01VR31E8al+jrTtrlo+3VuTcVPQ+mGdoRIe?= =?iso-8859-1?Q?gZPQuqkOizW4R3I0mXv2YfSzgFy4fXfGkOnATXYLCOFDLxKrzPPwNHZSC5?= =?iso-8859-1?Q?23SbhUDun4kp+1PrB/B+nb6cwqtSBVFdjeT1/21Lkm5SNdQ9Xrw52rRIq3?= =?iso-8859-1?Q?Ii2cahX3jmgPjOmaPIQahjJPakQBDmZhQsBO9fk7jD47Uuxvo3DVWLKjvV?= =?iso-8859-1?Q?/IzBi/LWd5NpfQbHZ+Mp9wd8DbLoECOz0AddsbWcRiYzg5pSsVqE0vK+em?= =?iso-8859-1?Q?IA95YRI+NPG0K85wA=3D?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1760 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 98d1594f-d003-4457-45c8-08d8b34226c9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: thb/+FG5uLNSFpzkbZFsEBV40HXjXXq/5q0nT46H1nJ/NXyRuPJpFTYxSy3bOINXqsGNMWGXTlk9q7x9gTjAWFPt07XvZ6LdUdDmuGBKzzoCOetmCX1jr6JKYd6Hk06OLLBVuhHMuibwOP2Y5LocoUc3QBCTKejpjtYkJC+nxrO8UPZaCqHZqePYTFOXt9LBeDSVokKnW/aX1qqRe4MGs+NcOdg1RJXWLSnBUfhCj9foIhLkzQqfqJFHahXQf/Blbjw9knmzz0n/jpyaRGhY2Kj0jWqOVkBaEOC21OVPKXi9L1u6trjbC27t9R995Q7TffPXj0BVKRCDoe5x2GX/7M6ckiGUjpjRzC8t956Qj1T/Fb48PNrNl9RIjfNRf8C1/ixXIuXCvIcnt1rhJskj+DrDpzu1ZHFodgQaFQCxYoqoSEx79aAapdMbNAm+zwvZ+EdnOjzkFjdwM+/kZnJzuGFFTXw55R1RX68doJPvWIo= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(136003)(396003)(376002)(39850400004)(346002)(46966006)(55016002)(6916009)(70586007)(316002)(86362001)(7696005)(356005)(186003)(2906002)(9686003)(26005)(83380400001)(82740400003)(5660300002)(82310400003)(81166007)(33656002)(336012)(70206006)(8936002)(52536014)(8676002)(34020700004)(6506007)(47076005)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2021 19:26:44.5213 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ad3f996-b8b4-4759-17ae-08d8b3422b34 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3724 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 19:26:50 -0000 Remove slow paths from atan. Add ULP annotations.=0A= =0A= Passes GLIBC testsuite.=0A= =0A= ---=0A= =0A= diff --git a/sysdeps/ieee754/dbl-64/atnat.h b/sysdeps/ieee754/dbl-64/atnat.= h=0A= index af4374019f1fce9b56b387b93a69d1330b9c8666..2b12481f0491ade9379c71ae989= 35ae8e67cb755 100644=0A= --- a/sysdeps/ieee754/dbl-64/atnat.h=0A= +++ b/sysdeps/ieee754/dbl-64/atnat.h=0A= @@ -29,7 +29,7 @@=0A= #define M 4=0A= =0A= #ifdef BIG_ENDI=0A= - static const number=0A= + static const mynumber=0A= /* polynomial I */=0A= /**/ d3 =3D {{0xbfd55555, 0x55555555} }, /* -0.333... */=0A= /**/ d5 =3D {{0x3fc99999, 0x999997fd} }, /* 0.199... */=0A= @@ -79,7 +79,7 @@=0A= =0A= #else=0A= #ifdef LITTLE_ENDI=0A= - static const number=0A= + static const mynumber=0A= /* polynomial I */=0A= /**/ d3 =3D {{0x55555555, 0xbfd55555} }, /* -0.333... */=0A= /**/ d5 =3D {{0x999997fd, 0x3fc99999} }, /* 0.199... */=0A= diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_ata= n.c=0A= index 291b988318a67444b473044b030619d2f7851585..977183eb928f62d110e2c9e9ca6= dd1f9286b1b97 100644=0A= --- a/sysdeps/ieee754/dbl-64/s_atan.c=0A= +++ b/sysdeps/ieee754/dbl-64/s_atan.c=0A= @@ -20,25 +20,15 @@=0A= /* MODULE_NAME: atnat.c */= =0A= /* */= =0A= /* FUNCTIONS: uatan */= =0A= -/* atanMp */= =0A= /* signArctan */= =0A= /* */= =0A= -/* */= =0A= -/* FILES NEEDED: dla.h endian.h mpa.h mydefs.h atnat.h */= =0A= -/* mpatan.c mpatan2.c mpsqrt.c */= =0A= +/* FILES NEEDED: dla.h endian.h mydefs.h atnat.h */= =0A= /* uatan.tbl */= =0A= /* */= =0A= -/* An ultimate atan() routine. Given an IEEE double machine number x */= =0A= -/* it computes the correctly rounded (to nearest) value of atan(x). */= =0A= -/* */= =0A= -/* Assumption: Machine arithmetic operations are performed in */= =0A= -/* round to nearest mode of IEEE 754 standard. */= =0A= -/* */= =0A= /************************************************************************/= =0A= =0A= #include =0A= -#include "mpa.h"=0A= -#include "MathLib.h"=0A= +#include "mydefs.h"=0A= #include "uatan.tbl"=0A= #include "atnat.h"=0A= #include =0A= @@ -47,10 +37,8 @@=0A= #include =0A= #include =0A= #include =0A= -#include =0A= =0A= -void __mpatan (mp_no *, mp_no *, int); /* see definition in mpatan.c */=0A= -static double atanMp (double, const int[]);=0A= +#define TWO52 0x1.0p52=0A= =0A= /* Fix the sign of y and return */=0A= static double=0A= @@ -59,17 +47,14 @@ __signArctan (double x, double y)=0A= return copysign (y, x);=0A= }=0A= =0A= -=0A= -/* An ultimate atan() routine. Given an IEEE double machine number x, *= /=0A= -/* routine computes the correctly rounded (to nearest) value of atan(x). *= /=0A= +/* atan with max ULP of ~0.523 based on random sampling. */=0A= double=0A= __atan (double x)=0A= {=0A= - double cor, s1, ss1, s2, ss2, t1, t2, t3, t4, u, u2, u3,=0A= - v, vv, w, ww, y, yy, z, zz;=0A= + double cor, t1, t2, t3, u,=0A= + v, w, ww, y, yy, z;=0A= int i, ux, dx;=0A= - static const int pr[M] =3D { 6, 8, 10, 32 };=0A= - number num;=0A= + mynumber num;=0A= =0A= num.d =3D x;=0A= ux =3D num.i[HIGH_HALF];=0A= @@ -102,36 +87,14 @@ __atan (double x)=0A= yy =3D d3.d + v * yy;=0A= yy *=3D x * v;=0A= =0A= - if ((y =3D x + (yy - U1 * x)) =3D=3D x + (yy + U1 * x))=0A= - return y;=0A= -=0A= - EMULV (x, x, v, vv); /* v+vv=3Dx^2 */=0A= -=0A= - s1 =3D f17.d + v * f19.d;=0A= - s1 =3D f15.d + v * s1;=0A= - s1 =3D f13.d + v * s1;=0A= - s1 =3D f11.d + v * s1;=0A= - s1 *=3D v;=0A= -=0A= - ADD2 (f9.d, ff9.d, s1, 0, s2, ss2, t1, t2);=0A= - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (f7.d, ff7.d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (f5.d, ff5.d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (f3.d, ff3.d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2);=0A= - MUL2 (x, 0, s1, ss1, s2, ss2, t1, t2);=0A= - ADD2 (x, 0, s2, ss2, s1, ss1, t1, t2);=0A= - if ((y =3D s1 + (ss1 - U5 * s1)) =3D=3D s1 + (ss1 + U5 * s1))=0A= - return y;=0A= -=0A= - return atanMp (x, pr);=0A= + y =3D x + yy;=0A= + /* Max ULP is 0.511. */=0A= + return y;=0A= }=0A= }=0A= else=0A= { /* B <=3D u < C */=0A= - i =3D (TWO52 + TWO8 * u) - TWO52;=0A= + i =3D (TWO52 + 256 * u) - TWO52;=0A= i -=3D 16;=0A= z =3D u - cij[i][0].d;=0A= yy =3D cij[i][5].d + z * cij[i][6].d;=0A= @@ -141,44 +104,9 @@ __atan (double x)=0A= yy *=3D z;=0A= =0A= t1 =3D cij[i][1].d;=0A= - if (i < 112)=0A= - {=0A= - if (i < 48)=0A= - u2 =3D U21; /* u < 1/4 */=0A= - else=0A= - u2 =3D U22;=0A= - } /* 1/4 <=3D u < 1/2 */=0A= - else=0A= - {=0A= - if (i < 176)=0A= - u2 =3D U23; /* 1/2 <=3D u < 3/4 */=0A= - else=0A= - u2 =3D U24;=0A= - } /* 3/4 <=3D u <=3D 1 */=0A= - if ((y =3D t1 + (yy - u2 * t1)) =3D=3D t1 + (yy + u2 * t1))=0A= - return __signArctan (x, y);=0A= -=0A= - z =3D u - hij[i][0].d;=0A= -=0A= - s1 =3D hij[i][14].d + z * hij[i][15].d;=0A= - s1 =3D hij[i][13].d + z * s1;=0A= - s1 =3D hij[i][12].d + z * s1;=0A= - s1 =3D hij[i][11].d + z * s1;=0A= - s1 *=3D z;=0A= -=0A= - ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2);=0A= - MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (hij[i][5].d, hij[i][6].d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (hij[i][3].d, hij[i][4].d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2);=0A= - if ((y =3D s2 + (ss2 - U6 * s2)) =3D=3D s2 + (ss2 + U6 * s2))=0A= - return __signArctan (x, y);=0A= -=0A= - return atanMp (x, pr);=0A= + y =3D t1 + yy;=0A= + /* Max ULP is 0.56. */=0A= + return __signArctan (x, y);=0A= }=0A= }=0A= else=0A= @@ -188,7 +116,7 @@ __atan (double x)=0A= w =3D 1 / u;=0A= EMULV (w, u, t1, t2);=0A= ww =3D w * ((1 - t1) - t2);=0A= - i =3D (TWO52 + TWO8 * w) - TWO52;=0A= + i =3D (TWO52 + 256 * w) - TWO52;=0A= i -=3D 16;=0A= z =3D (w - cij[i][0].d) + ww;=0A= =0A= @@ -199,37 +127,9 @@ __atan (double x)=0A= yy =3D HPI1 - z * yy;=0A= =0A= t1 =3D HPI - cij[i][1].d;=0A= - if (i < 112)=0A= - u3 =3D U31; /* w < 1/2 */=0A= - else=0A= - u3 =3D U32; /* w >=3D 1/2 */=0A= - if ((y =3D t1 + (yy - u3)) =3D=3D t1 + (yy + u3))=0A= - return __signArctan (x, y);=0A= -=0A= - DIV2 (1, 0, u, 0, w, ww, t1, t2, t3, t4);=0A= - t1 =3D w - hij[i][0].d;=0A= - EADD (t1, ww, z, zz);=0A= -=0A= - s1 =3D hij[i][14].d + z * hij[i][15].d;=0A= - s1 =3D hij[i][13].d + z * s1;=0A= - s1 =3D hij[i][12].d + z * s1;=0A= - s1 =3D hij[i][11].d + z * s1;=0A= - s1 *=3D z;=0A= -=0A= - ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2);=0A= - MUL2 (z, zz, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (z, zz, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (hij[i][5].d, hij[i][6].d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (z, zz, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (hij[i][3].d, hij[i][4].d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (z, zz, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2);=0A= - SUB2 (HPI, HPI1, s2, ss2, s1, ss1, t1, t2);=0A= - if ((y =3D s1 + (ss1 - U7)) =3D=3D s1 + (ss1 + U7))=0A= - return __signArctan (x, y);=0A= -=0A= - return atanMp (x, pr);=0A= + y =3D t1 + yy;=0A= + /* Max ULP is 0.503. */=0A= + return __signArctan (x, y);=0A= }=0A= else=0A= {=0A= @@ -249,34 +149,9 @@ __atan (double x)=0A= ww =3D w * ((1 - t1) - t2);=0A= ESUB (HPI, w, t3, cor);=0A= yy =3D ((HPI1 + cor) - ww) - yy;=0A= - if ((y =3D t3 + (yy - U4)) =3D=3D t3 + (yy + U4))=0A= - return __signArctan (x, y);=0A= -=0A= - DIV2 (1, 0, u, 0, w, ww, t1, t2, t3, t4);=0A= - MUL2 (w, ww, w, ww, v, vv, t1, t2);=0A= -=0A= - s1 =3D f17.d + v * f19.d;=0A= - s1 =3D f15.d + v * s1;=0A= - s1 =3D f13.d + v * s1;=0A= - s1 =3D f11.d + v * s1;=0A= - s1 *=3D v;=0A= -=0A= - ADD2 (f9.d, ff9.d, s1, 0, s2, ss2, t1, t2);=0A= - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (f7.d, ff7.d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (f5.d, ff5.d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2);=0A= - ADD2 (f3.d, ff3.d, s1, ss1, s2, ss2, t1, t2);=0A= - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2);=0A= - MUL2 (w, ww, s1, ss1, s2, ss2, t1, t2);=0A= - ADD2 (w, ww, s2, ss2, s1, ss1, t1, t2);=0A= - SUB2 (HPI, HPI1, s1, ss1, s2, ss2, t1, t2);=0A= -=0A= - if ((y =3D s2 + (ss2 - U8)) =3D=3D s2 + (ss2 + U8))=0A= - return __signArctan (x, y);=0A= -=0A= - return atanMp (x, pr);=0A= + y =3D t3 + yy;=0A= + /* Max ULP is 0.5003. */=0A= + return __signArctan (x, y);=0A= }=0A= else=0A= {=0A= @@ -290,35 +165,6 @@ __atan (double x)=0A= }=0A= }=0A= =0A= - /* Final stages. Compute atan(x) by multiple precision arithmetic */=0A= -static double=0A= -atanMp (double x, const int pr[])=0A= -{=0A= - mp_no mpx, mpy, mpy2, mperr, mpt1, mpy1;=0A= - double y1, y2;=0A= - int i, p;=0A= -=0A= - for (i =3D 0; i < M; i++)=0A= - {=0A= - p =3D pr[i];=0A= - __dbl_mp (x, &mpx, p);=0A= - __mpatan (&mpx, &mpy, p);=0A= - __dbl_mp (u9[i].d, &mpt1, p);=0A= - __mul (&mpy, &mpt1, &mperr, p);=0A= - __add (&mpy, &mperr, &mpy1, p);=0A= - __sub (&mpy, &mperr, &mpy2, p);=0A= - __mp_dbl (&mpy1, &y1, p);=0A= - __mp_dbl (&mpy2, &y2, p);=0A= - if (y1 =3D=3D y2)=0A= - {=0A= - LIBC_PROBE (slowatan, 3, &p, &x, &y1);=0A= - return y1;=0A= - }=0A= - }=0A= - LIBC_PROBE (slowatan_inexact, 3, &p, &x, &y1);=0A= - return y1; /*if impossible to do exact computing */=0A= -}=0A= -=0A= #ifndef __atan=0A= libm_alias_double (__atan, atan)=0A= #endif=0A= diff --git a/sysdeps/ieee754/dbl-64/uatan.tbl b/sysdeps/ieee754/dbl-64/uata= n.tbl=0A= index 8a477caa385d3f447abacf8490a8b45278d86610..fdc3e53304112eb31863a3144d6= acb2f65a77a2e 100644=0A= --- a/sysdeps/ieee754/dbl-64/uatan.tbl=0A= +++ b/sysdeps/ieee754/dbl-64/uatan.tbl=0A= @@ -25,7 +25,7 @@=0A= =0A= #ifdef BIG_ENDI=0A= =0A= - static const number=0A= + static const mynumber=0A= cij[241][7] =3D { /* x0,cij for (1/16,1)= */=0A= /**/ {{{0X3FB04006, 0X65E0244E} },=0A= /**/ {{0X3FB03A73, 0X7B53DD20} },=0A= @@ -1716,7 +1716,7 @@=0A= /**/ {{0XBF99B9A7, 0X18A3BA58} } },=0A= };=0A= =0A= - static const number=0A= + static const mynumber=0A= hij[241][16] =3D { /* x0,hij for (1/16,1)= */=0A= /**/ {{{0x3fb04000, 0x00000000} },=0A= /**/ {{0x3fb03a6d, 0x1c06693d} },=0A= @@ -5579,7 +5579,7 @@=0A= #else=0A= #ifdef LITTLE_ENDI=0A= =0A= - static const number=0A= + static const mynumber=0A= cij[241][7] =3D { /* x0,cij for (1/16,1)= */=0A= /**/ {{{0X65E0244E, 0X3FB04006} },=0A= /**/ {{0X7B53DD20, 0X3FB03A73} },=0A= @@ -7270,7 +7270,7 @@=0A= /**/ {{0X18A3BA58, 0XBF99B9A7} } },=0A= };=0A= =0A= - static const number=0A= + static const mynumber=0A= hij[241][16] =3D { /* x0,hij for (1/16,1)= */=0A= /**/ {{{0x00000000, 0x3fb04000} },=0A= /**/ {{0x1c06693d, 0x3fb03a6d} },=0A=