From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2074.outbound.protection.outlook.com [40.107.21.74]) by sourceware.org (Postfix) with ESMTPS id 6DD7538708EE for ; Mon, 4 Jan 2021 12:15:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6DD7538708EE Received: from DB6PR07CA0077.eurprd07.prod.outlook.com (2603:10a6:6:2b::15) by PAXPR08MB6637.eurprd08.prod.outlook.com (2603:10a6:102:153::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20; Mon, 4 Jan 2021 12:15:47 +0000 Received: from DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2b:cafe::2b) by DB6PR07CA0077.outlook.office365.com (2603:10a6:6:2b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.4 via Frontend Transport; Mon, 4 Jan 2021 12:15:47 +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 DB5EUR03FT049.mail.protection.outlook.com (10.152.20.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.21 via Frontend Transport; Mon, 4 Jan 2021 12:15:47 +0000 Received: ("Tessian outbound 39646a0fd094:v71"); Mon, 04 Jan 2021 12:15:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: bba2c8ff88d894de X-CR-MTA-TID: 64aa7808 Received: from a6b2d77ded60.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D52A622A-75D8-4E9F-A92F-D0676B4A5F82.1; Mon, 04 Jan 2021 12:15:31 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a6b2d77ded60.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 04 Jan 2021 12:15:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BekU6vc/AtAWNuuE20rKrfTol2KVlwVz0+NL70l6kxPjVi/mAf7hleN5O6RnvGqYESkWtThYJ5HVVyjZxI7wCMsQNbr8Ihjdl7hp+hIm9qkezR+ieaOI2XgIUVpxDkTEBnZwKg6o0Lqsa6w6fuK9UxPTcilxRjCG993QFJmBxeSCkIrpeS/I/f7D6p1o5cykErpgtflfiy6a9s8ZVUM6O1RcVcW1tX44LDRmzuacCJRyyTw4jkExkIIVa8vfarHA0bOV9Jzty3QInL9h1IQP43OJVAFYhs/PqOiPkWEfhf8lbdyn8Gs45L8mNV5sxMFgYr9s29Zp8DYO7A0ESpfvFw== 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=ia4uEk603r6PZa+pVUx4LxqxOFB4yqqPQVFKCQLLgHA=; b=BlPkueLsJhramb0C4yxtVNec6nBhR1nI19zIWeBmRR/RSLbg6hI5hKNS1M80peNU0pBmxkQi/DNsYFEejczs1Bsoamj9PEy5zXQkoOwOVJaRJQrjfwED4/XtL+9n9mhNZm27zoOC4Yqj+FaZiIybPIBaKdlbQx7xYMmjR8TDRLXatS8Ql/9qlWhZFASsEiKT9GSCFr6F0WkkojLFH30sZDn+Ve6Eqjw4HwGhysEkv/oPvlJsuWrz/Gqs1oHQ3lBPiaaqw9pClxG2EXQy1IU1E4d4xrAMlbUIN9z8ElAafAof3n+6ySl4lmorodXrtREsK/w6oqfE0L2SXURB37ToPQ== 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 VE1PR08MB4718.eurprd08.prod.outlook.com (2603:10a6:802:a5::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.22; Mon, 4 Jan 2021 12:15:30 +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.3721.024; Mon, 4 Jan 2021 12:15:30 +0000 From: Wilco Dijkstra To: 'GNU C Library' Subject: [PATCH 1/5] Remove slow paths from asin Thread-Topic: [PATCH 1/5] Remove slow paths from asin Thread-Index: AQHW4pNLa+R92rzo9kyN6J89Kk60Ug== Date: Mon, 4 Jan 2021 12:15:30 +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: 49720f6a-22f1-4f98-7d54-08d8b0aa77de x-ms-traffictypediagnostic: VE1PR08MB4718:|PAXPR08MB6637: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:605;OLM:605; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: +EUK5ZjucZXsel8hXZiA+GJTkx+MAD6wS7SZBibswmRhPi0nOw8bEn1kufuUQ3m9Pwrn09sfOVu6/+JB585pbbcO0i+5qQTfGXUgOYQM+tMf0CqaFgZqiazp4woANhTbdePDHDHRv6PilxLmX2HZ9ezS69xyhwNGX0X0m3HnBaez8g81cpSxtdWY0XEW+JWrGAFKStfmo2Q9foWzhmEpsIQD0YEOWNmvUFyZWo9BMDUulo/BUALDiRg+jgSwNBGlrMG7JrvZS9CXxEUqxyYlk5a2hlT+DEkO2wTjpBOvEFoc0lzEtAjKw1caTAYIRcNFAbVHyrD5xRd2y2KyjaxWyqmcr1AFLoxf8mCHHxgQF4FYwhGck1iyYH9LAFA4lxdbMebCMf2CocowbanFcS65YQ== 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)(136003)(39860400002)(366004)(396003)(346002)(376002)(91956017)(66446008)(8936002)(478600001)(66476007)(66556008)(64756008)(66946007)(71200400001)(7696005)(33656002)(30864003)(26005)(8676002)(186003)(55016002)(316002)(76116006)(2906002)(9686003)(86362001)(83380400001)(5660300002)(2940100002)(52536014)(6506007)(6916009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?z+ME9xXK07G2JQqo7Xs4E+/1X5sHlSFbsMyf+YxxCQNHGOrcICoRbSejBi?= =?iso-8859-1?Q?OrqDnuaeNc9gFPe53uvskrnd7PbbSb/+c/2r0MkmeQEQ1eWiaAbXK/wYS9?= =?iso-8859-1?Q?HzEuBJ2/KIgfGOk3sVgfAvCV7EgRYXP8Syj5dGP/bWqmzLjikHIU33sNTn?= =?iso-8859-1?Q?f1RZANCrTUxVTp31W3XZKkst22PPjZjTp9aD3sO1R/uzlkp/LQqeZz5Sso?= =?iso-8859-1?Q?lIX7MXCCrA0NMXkarzNftR8Crz/IoADHvW0EUW4Llhcjdb08tdwG3fwC5N?= =?iso-8859-1?Q?/Ac40+9w/eh/4XbyVxZlFkNKiGw7M4uHJfDSb0rJXo5yfvl/PjD5MIeRaI?= =?iso-8859-1?Q?VBEW/4OjsdjZPIPyWdNRsj48x2uefm2GIHflY56leCzUvL+GLFJKi6H4nr?= =?iso-8859-1?Q?XYiIg+vxe1geHNtd2qbxJBV4abX9oLt/ncfpQ38AZbZOO+e1MoM46Mgile?= =?iso-8859-1?Q?LqmVCj8qG72R/SpjvpQSV9LlSQkXItPz6lkYHS62VMBEF6T+XLTp2qWZGn?= =?iso-8859-1?Q?c3/cue9lT/PM2pzZnhYNrPIR/jjTBkkxa+GPcVE5UG2Rr3ear15AXtgYBa?= =?iso-8859-1?Q?emepEz+7eerE63QaUh2Mybazg62pMIyJWwC+29Vs2/SfByOmzpBbZ+15CS?= =?iso-8859-1?Q?5rt8EnGZMRbyVkhr2Zm/qgPtfYq0b3+C4SPyIVREsb3N0dek8Lt4gl8Gjt?= =?iso-8859-1?Q?IzgHIakkyAyuX+RqYZwJSvWyqyEBP101G+0VOUnFgad0BXj2DAUFsTSB9M?= =?iso-8859-1?Q?tHU1wGXYw8qAZb/diEHEEUeGXJRNxos2VvzmXob+TlWWv0FxrR0g8eZtkV?= =?iso-8859-1?Q?XbMKawaTyGVA43/uy7X68GbAHbSLmuyioICebueHgCl2SOBckuQskMQOQH?= =?iso-8859-1?Q?zh/HQdgw2DSY4kHbCP62qX0Ioi9i2j6n0l0PBimrdrWgJ7SJywbXG/K2Mt?= =?iso-8859-1?Q?ky1UgUUZgA1Ni4aBiPwoFMdRAU73CNHs7Pn7Zfulvzb0poZEh0YKF/B3Jh?= =?iso-8859-1?Q?HFrV18wtcnnErZwFU=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: VE1PR08MB4718 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: DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 37f2d6bf-7733-49ec-40c0-08d8b0aa6d95 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lMVReaVyUAQc5oS3OcDoDUNZaUi+6NQFuaHxUFytFtPZCoIIQycUUpcDBI0c8gna82fARVk5ptgbHF4u4IBcp1jcR/tmmORnlpTL+VWSHY+PphZ5xwTkJ0grmQBfDv+mukaBP5fJ1mGwrS3PyeSnm+56fcysJK6hEsphb4Mm4QsfBDWqyKxA7v0t7u5CB1dXIq4Nf2wXMIQLNuUmD1lR/+/XVJbQRgZb1RU2DYpzzGMLDT2Tt6waEg9iGsJmETH6Sjmm0HqBpsYdv4ngd3h0sOVueNCrf1TkbbVNgzOZlDNpTqOcuNBoeVLNL3jwYm80Qlx3jgR2D+4OlSlXIdrwS6N8KT1zbShNEE8DI46KpJApGW19HoDMzjTTCMT+FRZ/584tEWapUtEo26wxmiEdUCQ1HY3XthayaJSvPD0bqJ2IBIZR3ZgA5uhL5YBIRXtIcQIhgPKX5cLaljY0mfegBA== 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)(39860400002)(346002)(396003)(376002)(136003)(46966006)(70586007)(70206006)(336012)(6916009)(86362001)(478600001)(6506007)(186003)(26005)(83380400001)(30864003)(5660300002)(82310400003)(52536014)(47076005)(7696005)(356005)(81166007)(9686003)(82740400003)(55016002)(316002)(8936002)(2940100002)(8676002)(33656002)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2021 12:15:47.4843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49720f6a-22f1-4f98-7d54-08d8b0aa77de 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: DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6637 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SCC_5_SHORT_WORD_LINES, 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: Mon, 04 Jan 2021 12:15:53 -0000 Remove slow paths from asin - there is quite a lot of redundant slow code t= hat can=0A= be removed while keeping ULP below 1. Add ULP annotations. Update AArch64= =0A= libm-test-ulps for asin.=0A= =0A= Passes GLIBC testsuite.=0A= =0A= ---=0A= =0A= diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulp= s=0A= index 22fcf8db73dc444c25e0c356b1e0036571edd112..bbadf667ee4b7a0cf80506d3215= 53f064049c516 100644=0A= --- a/sysdeps/aarch64/libm-test-ulps=0A= +++ b/sysdeps/aarch64/libm-test-ulps=0A= @@ -41,6 +41,7 @@ float: 2=0A= ldouble: 2=0A= =0A= Function: "asin":=0A= +double: 1=0A= float: 1=0A= ldouble: 1=0A= =0A= @@ -55,7 +56,7 @@ float: 1=0A= ldouble: 1=0A= =0A= Function: "asin_upward":=0A= -double: 1=0A= +double: 2=0A= float: 1=0A= ldouble: 2=0A= =0A= diff --git a/sysdeps/ieee754/dbl-64/e_asin.c b/sysdeps/ieee754/dbl-64/e_asi= n.c=0A= index 8a3b26f6645b66818ad0a57fe833355a3e9961e6..c01e8a34517e4a33f126bbab5c1= 32379b4b58a4d 100644=0A= --- a/sysdeps/ieee754/dbl-64/e_asin.c=0A= +++ b/sysdeps/ieee754/dbl-64/e_asin.c=0A= @@ -21,8 +21,7 @@=0A= /* */=0A= /* FUNCTIONS: uasin */=0A= /* uacos */=0A= -/* FILES NEEDED: dla.h endian.h mpa.h mydefs.h usncs.h */=0A= -/* doasin.c sincos32.c dosincos.c mpa.c */=0A= +/* FILES NEEDED: dla.h endian.h mydefs.h usncs.h */=0A= /* sincos.tbl asincos.tbl powtwo.tbl root.tbl */=0A= /* */=0A= /******************************************************************/=0A= @@ -31,7 +30,6 @@=0A= #include "asincos.tbl"=0A= #include "root.tbl"=0A= #include "powtwo.tbl"=0A= -#include "MathLib.h"=0A= #include "uasncs.h"=0A= #include =0A= #include =0A= @@ -43,15 +41,10 @@=0A= # define SECTION=0A= #endif=0A= =0A= -void __doasin(double x, double dx, double w[]);=0A= -void __dubsin(double x, double dx, double v[]);=0A= -void __dubcos(double x, double dx, double v[]);=0A= -void __docos(double x, double dx, double v[]);=0A= -=0A= double=0A= SECTION=0A= __ieee754_asin(double x){=0A= - double x1,x2,xx,s1,s2,res1,p,t,res,r,cor,cc,y,c,z,w[2];=0A= + double x2,xx,res1,p,t,res,r,cor,cc,y,c,z;=0A= mynumber u,v;=0A= int4 k,m,n;=0A= =0A= @@ -70,27 +63,8 @@ __ieee754_asin(double x){=0A= x2 =3D x*x;=0A= t =3D (((((f6*x2 + f5)*x2 + f4)*x2 + f3)*x2 + f2)*x2 + f1)*(x2*x);=0A= res =3D x+t; /* res=3Darcsin(x) according to Taylor series *= /=0A= - cor =3D (x-res)+t;=0A= - if (res =3D=3D res+1.025*cor) return res;=0A= - else {=0A= - x1 =3D x+big;=0A= - xx =3D x*x;=0A= - x1 -=3D big;=0A= - x2 =3D x - x1;=0A= - p =3D x1*x1*x1;=0A= - s1 =3D a1.x*p;=0A= - s2 =3D ((((((c7*xx + c6)*xx + c5)*xx + c4)*xx + c3)*xx + c2)*xx*xx*x= +=0A= - ((a1.x+a2.x)*x2*x2+ 0.5*x1*x)*x2) + a2.x*p;=0A= - res1 =3D x+s1;=0A= - s2 =3D ((x-res1)+s1)+s2;=0A= - res =3D res1+s2;=0A= - cor =3D (res1-res)+s2;=0A= - if (res =3D=3D res+1.00014*cor) return res;=0A= - else {=0A= - __doasin(x,0,w);=0A= - return w[0];=0A= - }=0A= - }=0A= + /* Max ULP is 0.512. */=0A= + return res;=0A= }=0A= /*---------------------0.125 <=3D |x| < 0.5 ----------------------------= -*/=0A= else if (k < 0x3fe00000) {=0A= @@ -103,26 +77,8 @@ __ieee754_asin(double x){=0A= +xx*asncs.x[n+6]))))+asncs.x[n+7];=0A= t+=3Dp;=0A= res =3Dasncs.x[n+8] +t;=0A= - cor =3D (asncs.x[n+8]-res)+t;=0A= - if (res =3D=3D res+1.05*cor) return (m>0)?res:-res;=0A= - else {=0A= - r=3Dasncs.x[n+8]+xx*asncs.x[n+9];=0A= - t=3D((asncs.x[n+8]-r)+xx*asncs.x[n+9])+(p+xx*asncs.x[n+10]);=0A= - res =3D r+t;=0A= - cor =3D (r-res)+t;=0A= - if (res =3D=3D res+1.0005*cor) return (m>0)?res:-res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - __dubsin(res,z,w);=0A= - z=3D(w[0]-fabs(x))+w[1];=0A= - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);=0A= - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);=0A= - else {=0A= - return (m>0)?res:-res;=0A= - }=0A= - }=0A= - }=0A= + /* Max ULP is 0.523. */=0A= + return (m>0)?res:-res;=0A= } /* else if (k < 0x3fe00000) */=0A= /*-------------------- 0.5 <=3D |x| < 0.75 -----------------------------= */=0A= else=0A= @@ -135,26 +91,8 @@ __ieee754_asin(double x){=0A= +xx*(asncs.x[n+6]+xx*asncs.x[n+7])))))+asncs.x[n+8];=0A= t+=3Dp;=0A= res =3Dasncs.x[n+9] +t;=0A= - cor =3D (asncs.x[n+9]-res)+t;=0A= - if (res =3D=3D res+1.01*cor) return (m>0)?res:-res;=0A= - else {=0A= - r=3Dasncs.x[n+9]+xx*asncs.x[n+10];=0A= - t=3D((asncs.x[n+9]-r)+xx*asncs.x[n+10])+(p+xx*asncs.x[n+11]);=0A= - res =3D r+t;=0A= - cor =3D (r-res)+t;=0A= - if (res =3D=3D res+1.0005*cor) return (m>0)?res:-res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - __dubsin(res,z,w);=0A= - z=3D(w[0]-fabs(x))+w[1];=0A= - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);=0A= - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);=0A= - else {=0A= - return (m>0)?res:-res;=0A= - }=0A= - }=0A= - }=0A= + /* Max ULP is 0.505. */=0A= + return (m>0)?res:-res;=0A= } /* else if (k < 0x3fe80000) */=0A= /*--------------------- 0.75 <=3D |x|< 0.921875 ----------------------*/= =0A= else=0A= @@ -167,28 +105,8 @@ __ieee754_asin(double x){=0A= +xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+xx*asncs.x[n+8]))))))+asncs.x[n+9]= ;=0A= t+=3Dp;=0A= res =3Dasncs.x[n+10] +t;=0A= - cor =3D (asncs.x[n+10]-res)+t;=0A= - if (res =3D=3D res+1.01*cor) return (m>0)?res:-res;=0A= - else {=0A= - r=3Dasncs.x[n+10]+xx*asncs.x[n+11];=0A= - t=3D((asncs.x[n+10]-r)+xx*asncs.x[n+11])+(p+xx*asncs.x[n+12]);=0A= - res =3D r+t;=0A= - cor =3D (r-res)+t;=0A= - if (res =3D=3D res+1.0008*cor) return (m>0)?res:-res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - y=3Dhp0.x-res;=0A= - z=3D((hp0.x-y)-res)+(hp1.x-z);=0A= - __dubcos(y,z,w);=0A= - z=3D(w[0]-fabs(x))+w[1];=0A= - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);=0A= - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);=0A= - else {=0A= - return (m>0)?res:-res;=0A= - }=0A= - }=0A= - }=0A= + /* Max ULP is 0.505. */=0A= + return (m>0)?res:-res;=0A= } /* else if (k < 0x3fed8000) */=0A= /*-------------------0.921875 <=3D |x| < 0.953125 ----------------------= --*/=0A= else=0A= @@ -203,29 +121,8 @@ __ieee754_asin(double x){=0A= xx*asncs.x[n+9])))))))+asncs.x[n+10];=0A= t+=3Dp;=0A= res =3Dasncs.x[n+11] +t;=0A= - cor =3D (asncs.x[n+11]-res)+t;=0A= - if (res =3D=3D res+1.01*cor) return (m>0)?res:-res;=0A= - else {=0A= - r=3Dasncs.x[n+11]+xx*asncs.x[n+12];=0A= - t=3D((asncs.x[n+11]-r)+xx*asncs.x[n+12])+(p+xx*asncs.x[n+13]);=0A= - res =3D r+t;=0A= - cor =3D (r-res)+t;=0A= - if (res =3D=3D res+1.0007*cor) return (m>0)?res:-res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - y=3D(hp0.x-res)-z;=0A= - z=3Dy+hp1.x;=0A= - y=3D(y-z)+hp1.x;=0A= - __dubcos(z,y,w);=0A= - z=3D(w[0]-fabs(x))+w[1];=0A= - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);=0A= - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);=0A= - else {=0A= - return (m>0)?res:-res;=0A= - }=0A= - }=0A= - }=0A= + /* Max ULP is 0.505. */=0A= + return (m>0)?res:-res;=0A= } /* else if (k < 0x3fee8000) */=0A= =0A= /*--------------------0.953125 <=3D |x| < 0.96875 ----------------------= --*/=0A= @@ -241,29 +138,8 @@ __ieee754_asin(double x){=0A= xx*(asncs.x[n+9]+xx*asncs.x[n+10]))))))))+asncs.x[n+11];=0A= t+=3Dp;=0A= res =3Dasncs.x[n+12] +t;=0A= - cor =3D (asncs.x[n+12]-res)+t;=0A= - if (res =3D=3D res+1.01*cor) return (m>0)?res:-res;=0A= - else {=0A= - r=3Dasncs.x[n+12]+xx*asncs.x[n+13];=0A= - t=3D((asncs.x[n+12]-r)+xx*asncs.x[n+13])+(p+xx*asncs.x[n+14]);=0A= - res =3D r+t;=0A= - cor =3D (r-res)+t;=0A= - if (res =3D=3D res+1.0007*cor) return (m>0)?res:-res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - y=3D(hp0.x-res)-z;=0A= - z=3Dy+hp1.x;=0A= - y=3D(y-z)+hp1.x;=0A= - __dubcos(z,y,w);=0A= - z=3D(w[0]-fabs(x))+w[1];=0A= - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1);=0A= - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1);=0A= - else {=0A= - return (m>0)?res:-res;=0A= - }=0A= - }=0A= - }=0A= + /* Max ULP is 0.505. */=0A= + return (m>0)?res:-res;=0A= } /* else if (k < 0x3fef0000) */=0A= /*--------------------0.96875 <=3D |x| < 1 -----------------------------= ---*/=0A= else=0A= @@ -282,16 +158,8 @@ __ieee754_asin(double x){=0A= cor =3D (hp1.x - 2.0*cc)-2.0*(y+cc)*p;=0A= res1 =3D hp0.x - 2.0*y;=0A= res =3Dres1 + cor;=0A= - if (res =3D=3D res+1.003*((res1-res)+cor)) return (m>0)?res:-res;=0A= - else {=0A= - c=3Dy+cc;=0A= - cc=3D(y-c)+cc;=0A= - __doasin(c,cc,w);=0A= - res1=3Dhp0.x-2.0*w[0];=0A= - cor=3D((hp0.x-res1)-2.0*w[0])+(hp1.x-2.0*w[1]);=0A= - res =3D res1+cor;=0A= - return (m>0)?res:-res;=0A= - }=0A= + /* Max ULP is 0.5015. */=0A= + return (m>0)?res:-res;=0A= } /* else if (k < 0x3ff00000) */=0A= /*---------------------------- |x|>=3D1 -------------------------------*= /=0A= else if (k=3D=3D0x3ff00000 && u.i[LOW_HALF]=3D=3D0) return (m>0)?hp0.x:-= hp0.x;=0A= @@ -319,7 +187,7 @@ double=0A= SECTION=0A= __ieee754_acos(double x)=0A= {=0A= - double x1,x2,xx,s1,s2,res1,p,t,res,r,cor,cc,y,c,z,w[2],eps;=0A= + double x2,xx,res1,p,t,res,r,cor,cc,y,c,z;=0A= mynumber u,v;=0A= int4 k,m,n;=0A= u.x =3D x;=0A= @@ -336,32 +204,8 @@ __ieee754_acos(double x)=0A= r=3Dhp0.x-x;=0A= cor=3D(((hp0.x-r)-x)+hp1.x)-t;=0A= res =3D r+cor;=0A= - cor =3D (r-res)+cor;=0A= - if (res =3D=3D res+1.004*cor) return res;=0A= - else {=0A= - x1 =3D x+big;=0A= - xx =3D x*x;=0A= - x1 -=3D big;=0A= - x2 =3D x - x1;=0A= - p =3D x1*x1*x1;=0A= - s1 =3D a1.x*p;=0A= - s2 =3D ((((((c7*xx + c6)*xx + c5)*xx + c4)*xx + c3)*xx + c2)*xx*xx*x= +=0A= - ((a1.x+a2.x)*x2*x2+ 0.5*x1*x)*x2) + a2.x*p;=0A= - res1 =3D x+s1;=0A= - s2 =3D ((x-res1)+s1)+s2;=0A= - r=3Dhp0.x-res1;=0A= - cor=3D(((hp0.x-r)-res1)+hp1.x)-s2;=0A= - res =3D r+cor;=0A= - cor =3D (r-res)+cor;=0A= - if (res =3D=3D res+1.00004*cor) return res;=0A= - else {=0A= - __doasin(x,0,w);=0A= - r=3Dhp0.x-w[0];=0A= - cor=3D((hp0.x-r)-w[0])+(hp1.x-w[1]);=0A= - res=3Dr+cor;=0A= - return res;=0A= - }=0A= - }=0A= + /* Max ULP is 0.502. */=0A= + return res;=0A= } /* else if (k < 0x3fc00000) */=0A= /*---------------------- 0.125 <=3D |x| < 0.5 --------------------*/=0A= else=0A= @@ -377,35 +221,16 @@ __ieee754_acos(double x)=0A= y =3D (m>0)?(hp0.x-asncs.x[n+8]):(hp0.x+asncs.x[n+8]);=0A= t =3D (m>0)?(hp1.x-t):(hp1.x+t);=0A= res =3D y+t;=0A= - if (res =3D=3D res+1.02*((y-res)+t)) return res;=0A= - else {=0A= - r=3Dasncs.x[n+8]+xx*asncs.x[n+9];=0A= - t=3D((asncs.x[n+8]-r)+xx*asncs.x[n+9])+(p+xx*asncs.x[n+10]);=0A= - if (m>0)=0A= - {p =3D hp0.x-r; t =3D (((hp0.x-p)-r)-t)+hp1.x; }=0A= - else=0A= - {p =3D hp0.x+r; t =3D ((hp0.x-p)+r)+(hp1.x+t); }=0A= - res =3D p+t;=0A= - cor =3D (p-res)+t;=0A= - if (res =3D=3D (res+1.0002*cor)) return res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - __docos(res,z,w);=0A= - z=3D(w[0]-x)+w[1];=0A= - if (z>1.0e-27) return max(res,res1);=0A= - else if (z<-1.0e-27) return min(res,res1);=0A= - else return res;=0A= - }=0A= - }=0A= + /* Max ULP is 0.51. */=0A= + return res;=0A= } /* else if (k < 0x3fe00000) */=0A= =0A= /*--------------------------- 0.5 <=3D |x| < 0.75 ---------------------*= /=0A= else=0A= if (k < 0x3fe80000) {=0A= n =3D 1056+((k&0x000fe000)>>11)*3;=0A= - if (m>0) {xx =3D x - asncs.x[n]; eps=3D1.04; }=0A= - else {xx =3D -x - asncs.x[n]; eps=3D1.02; }=0A= + if (m>0) {xx =3D x - asncs.x[n]; }=0A= + else {xx =3D -x - asncs.x[n]; }=0A= t =3D asncs.x[n+1]*xx;=0A= p=3Dxx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+=0A= xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+=0A= @@ -414,33 +239,16 @@ __ieee754_acos(double x)=0A= y =3D (m>0)?(hp0.x-asncs.x[n+9]):(hp0.x+asncs.x[n+9]);=0A= t =3D (m>0)?(hp1.x-t):(hp1.x+t);=0A= res =3D y+t;=0A= - if (res =3D=3D res+eps*((y-res)+t)) return res;=0A= - else {=0A= - r=3Dasncs.x[n+9]+xx*asncs.x[n+10];=0A= - t=3D((asncs.x[n+9]-r)+xx*asncs.x[n+10])+(p+xx*asncs.x[n+11]);=0A= - if (m>0) {p =3D hp0.x-r; t =3D (((hp0.x-p)-r)-t)+hp1.x; eps=3D1.0004;= }=0A= - else {p =3D hp0.x+r; t =3D ((hp0.x-p)+r)+(hp1.x+t); eps=3D1.0002; }= =0A= - res =3D p+t;=0A= - cor =3D (p-res)+t;=0A= - if (res =3D=3D (res+eps*cor)) return res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - __docos(res,z,w);=0A= - z=3D(w[0]-x)+w[1];=0A= - if (z>1.0e-27) return max(res,res1);=0A= - else if (z<-1.0e-27) return min(res,res1);=0A= - else return res;=0A= - }=0A= - }=0A= + /* Max ULP is 0.52. */=0A= + return res;=0A= } /* else if (k < 0x3fe80000) */=0A= =0A= /*------------------------- 0.75 <=3D |x| < 0.921875 -------------*/=0A= else=0A= if (k < 0x3fed8000) {=0A= n =3D 992+((k&0x000fe000)>>13)*13;=0A= - if (m>0) {xx =3D x - asncs.x[n]; eps =3D 1.04; }=0A= - else {xx =3D -x - asncs.x[n]; eps =3D 1.01; }=0A= + if (m>0) {xx =3D x - asncs.x[n]; }=0A= + else {xx =3D -x - asncs.x[n]; }=0A= t =3D asncs.x[n+1]*xx;=0A= p=3Dxx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+=0A= xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+=0A= @@ -449,33 +257,16 @@ __ieee754_acos(double x)=0A= y =3D (m>0)?(hp0.x-asncs.x[n+10]):(hp0.x+asncs.x[n+10]);=0A= t =3D (m>0)?(hp1.x-t):(hp1.x+t);=0A= res =3D y+t;=0A= - if (res =3D=3D res+eps*((y-res)+t)) return res;=0A= - else {=0A= - r=3Dasncs.x[n+10]+xx*asncs.x[n+11];=0A= - t=3D((asncs.x[n+10]-r)+xx*asncs.x[n+11])+(p+xx*asncs.x[n+12]);=0A= - if (m>0) {p =3D hp0.x-r; t =3D (((hp0.x-p)-r)-t)+hp1.x; eps=3D1.0032= ; }=0A= - else {p =3D hp0.x+r; t =3D ((hp0.x-p)+r)+(hp1.x+t); eps=3D1.0008; = }=0A= - res =3D p+t;=0A= - cor =3D (p-res)+t;=0A= - if (res =3D=3D (res+eps*cor)) return res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - __docos(res,z,w);=0A= - z=3D(w[0]-x)+w[1];=0A= - if (z>1.0e-27) return max(res,res1);=0A= - else if (z<-1.0e-27) return min(res,res1);=0A= - else return res;=0A= - }=0A= - }=0A= + /* Max ULP is 0.52. */=0A= + return res;=0A= } /* else if (k < 0x3fed8000) */=0A= =0A= /*-------------------0.921875 <=3D |x| < 0.953125 ------------------*/=0A= else=0A= if (k < 0x3fee8000) {=0A= n =3D 884+((k&0x000fe000)>>13)*14;=0A= - if (m>0) {xx =3D x - asncs.x[n]; eps=3D1.04; }=0A= - else {xx =3D -x - asncs.x[n]; eps =3D1.005; }=0A= + if (m>0) {xx =3D x - asncs.x[n]; }=0A= + else {xx =3D -x - asncs.x[n]; }=0A= t =3D asncs.x[n+1]*xx;=0A= p=3Dxx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+=0A= xx*(asncs.x[n+5]+xx*(asncs.x[n+6]=0A= @@ -485,33 +276,16 @@ __ieee754_acos(double x)=0A= y =3D (m>0)?(hp0.x-asncs.x[n+11]):(hp0.x+asncs.x[n+11]);=0A= t =3D (m>0)?(hp1.x-t):(hp1.x+t);=0A= res =3D y+t;=0A= - if (res =3D=3D res+eps*((y-res)+t)) return res;=0A= - else {=0A= - r=3Dasncs.x[n+11]+xx*asncs.x[n+12];=0A= - t=3D((asncs.x[n+11]-r)+xx*asncs.x[n+12])+(p+xx*asncs.x[n+13]);=0A= - if (m>0) {p =3D hp0.x-r; t =3D (((hp0.x-p)-r)-t)+hp1.x; eps=3D1.0030= ; }=0A= - else {p =3D hp0.x+r; t =3D ((hp0.x-p)+r)+(hp1.x+t); eps=3D1.0005; = }=0A= - res =3D p+t;=0A= - cor =3D (p-res)+t;=0A= - if (res =3D=3D (res+eps*cor)) return res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - __docos(res,z,w);=0A= - z=3D(w[0]-x)+w[1];=0A= - if (z>1.0e-27) return max(res,res1);=0A= - else if (z<-1.0e-27) return min(res,res1);=0A= - else return res;=0A= - }=0A= - }=0A= + /* Max ULP is 0.52. */=0A= + return res;=0A= } /* else if (k < 0x3fee8000) */=0A= =0A= /*--------------------0.953125 <=3D |x| < 0.96875 ----------------*/=0A= else=0A= if (k < 0x3fef0000) {=0A= n =3D 768+((k&0x000fe000)>>13)*15;=0A= - if (m>0) {xx =3D x - asncs.x[n]; eps=3D1.04; }=0A= - else {xx =3D -x - asncs.x[n]; eps=3D1.005;}=0A= + if (m>0) {xx =3D x - asncs.x[n]; }=0A= + else {xx =3D -x - asncs.x[n]; }=0A= t =3D asncs.x[n+1]*xx;=0A= p=3Dxx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+=0A= xx*(asncs.x[n+5]+xx*(asncs.x[n+6]=0A= @@ -521,25 +295,8 @@ __ieee754_acos(double x)=0A= y =3D (m>0)?(hp0.x-asncs.x[n+12]):(hp0.x+asncs.x[n+12]);=0A= t =3D (m>0)?(hp1.x-t):(hp1.x+t);=0A= res =3D y+t;=0A= - if (res =3D=3D res+eps*((y-res)+t)) return res;=0A= - else {=0A= - r=3Dasncs.x[n+12]+xx*asncs.x[n+13];=0A= - t=3D((asncs.x[n+12]-r)+xx*asncs.x[n+13])+(p+xx*asncs.x[n+14]);=0A= - if (m>0) {p =3D hp0.x-r; t =3D (((hp0.x-p)-r)-t)+hp1.x; eps=3D1.0030;= }=0A= - else {p =3D hp0.x+r; t =3D ((hp0.x-p)+r)+(hp1.x+t); eps=3D1.0005; }= =0A= - res =3D p+t;=0A= - cor =3D (p-res)+t;=0A= - if (res =3D=3D (res+eps*cor)) return res;=0A= - else {=0A= - res1=3Dres+1.1*cor;=0A= - z=3D0.5*(res1-res);=0A= - __docos(res,z,w);=0A= - z=3D(w[0]-x)+w[1];=0A= - if (z>1.0e-27) return max(res,res1);=0A= - else if (z<-1.0e-27) return min(res,res1);=0A= - else return res;=0A= - }=0A= - }=0A= + /* Max ULP is 0.52. */=0A= + return res;=0A= } /* else if (k < 0x3fef0000) */=0A= /*-----------------0.96875 <=3D |x| < 1 ---------------------------*/=0A= =0A= @@ -560,28 +317,14 @@ __ieee754_acos(double x)=0A= cor =3D (hp1.x - cc)-(y+cc)*p;=0A= res1 =3D hp0.x - y;=0A= res =3Dres1 + cor;=0A= - if (res =3D=3D res+1.002*((res1-res)+cor)) return (res+res);=0A= - else {=0A= - c=3Dy+cc;=0A= - cc=3D(y-c)+cc;=0A= - __doasin(c,cc,w);=0A= - res1=3Dhp0.x-w[0];=0A= - cor=3D((hp0.x-res1)-w[0])+(hp1.x-w[1]);=0A= - res =3D res1+cor;=0A= - return (res+res);=0A= - }=0A= + /* Max ULP is 0.501. */=0A= + return (res+res);=0A= }=0A= else {=0A= cor =3D cc+p*(y+cc);=0A= res =3D y + cor;=0A= - if (res =3D=3D res+1.03*((y-res)+cor)) return (res+res);=0A= - else {=0A= - c=3Dy+cc;=0A= - cc=3D(y-c)+cc;=0A= - __doasin(c,cc,w);=0A= - res =3D w[0];=0A= - return (res+res);=0A= - }=0A= + /* Max ULP is 0.515. */=0A= + return (res+res);=0A= }=0A= } /* else if (k < 0x3ff00000) */=0A= =0A=