From patchwork Mon Jan 4 12:15:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 41619 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 106693870907; Mon, 4 Jan 2021 12:15:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 106693870907 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609762554; bh=ia4uEk603r6PZa+pVUx4LxqxOFB4yqqPQVFKCQLLgHA=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=D2UPxn10QQBkR0r6/RJ9Anyj4Hg96KNGN8zCNhLMKnc11hIaywN75CLoIGrsL63dF ou60NNN9DFzB1MDonxTb3e2CtYmtq3H/i97v7dwl1TZwWNXRX9yEAcBkF1rmCqzlkN BkGsk97SkYAqZnQQA7wNSZ4d8foEUENBwrLhf9+I= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 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+/1X?= =?iso-8859-1?q?5sHlSFbsMyf+YxxCQNHGOrcICoRbSejBiOrqDnuaeNc9gFPe53uvskrnd7Pb?= =?iso-8859-1?q?bSb/+c/2r0MkmeQEQ1eWiaAbXK/wYS9HzEuBJ2/KIgfGOk3sVgfAvCV7EgRY?= =?iso-8859-1?q?XP8Syj5dGP/bWqmzLjikHIU33sNTnf1RZANCrTUxVTp31W3XZKkst22PPjZj?= =?iso-8859-1?q?Tp9aD3sO1R/uzlkp/LQqeZz5SsolIX7MXCCrA0NMXkarzNftR8Crz/IoADHv?= =?iso-8859-1?q?W0EUW4Llhcjdb08tdwG3fwC5N/Ac40+9w/eh/4XbyVxZlFkNKiGw7M4uHJfD?= =?iso-8859-1?q?Sb0rJXo5yfvl/PjD5MIeRaIVBEW/4OjsdjZPIPyWdNRsj48x2uefm2GIHflY?= =?iso-8859-1?q?56leCzUvL+GLFJKi6H4nrXYiIg+vxe1geHNtd2qbxJBV4abX9oLt/ncfpQ38?= =?iso-8859-1?q?AZbZOO+e1MoM46MgileLqmVCj8qG72R/SpjvpQSV9LlSQkXItPz6lkYHS62V?= =?iso-8859-1?q?MBEF6T+XLTp2qWZGnc3/cue9lT/PM2pzZnhYNrPIR/jjTBkkxa+GPcVE5UG2?= =?iso-8859-1?q?Rr3ear15AXtgYBaemepEz+7eerE63QaUh2Mybazg62pMIyJWwC+29Vs2/SfB?= =?iso-8859-1?q?yOmzpBbZ+15CS5rt8EnGZMRbyVkhr2Zm/qgPtfYq0b3+C4SPyIVREsb3N0de?= =?iso-8859-1?q?k8Lt4gl8GjtIzgHIakkyAyuX+RqYZwJSvWyqyEBP101G+0VOUnFgad0BXj2D?= =?iso-8859-1?q?AUFsTSB9MtHU1wGXYw8qAZb/diEHEEUeGXJRNxos2VvzmXob+TlWWv0FxrR0?= =?iso-8859-1?q?g8eZtkVXbMKawaTyGVA43/uy7X68GbAHbSLmuyioICebueHgCl2SOBckuQsk?= =?iso-8859-1?q?MQOQHzh/HQdgw2DSY4kHbCP62qX0Ioi9i2j6n0l0PBimrdrWgJ7SJywbXG/K?= =?iso-8859-1?q?2Mtky1UgUUZgA1Ni4aBiPwoFMdRAU73CNHs7Pn7Zfulvzb0poZEh0YKF/B3J?= =?iso-8859-1?q?hHFrV18wtcnnErZwFU=3D?= x-ms-exchange-transport-forked: True 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-Patchwork-Original-From: Wilco Dijkstra via Libc-alpha From: Wilco Dijkstra Reply-To: Wilco Dijkstra Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Remove slow paths from asin - there is quite a lot of redundant slow code that can be removed while keeping ULP below 1. Add ULP annotations. Update AArch64 libm-test-ulps for asin. Passes GLIBC testsuite. diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps index 22fcf8db73dc444c25e0c356b1e0036571edd112..bbadf667ee4b7a0cf80506d321553f064049c516 100644 --- a/sysdeps/aarch64/libm-test-ulps +++ b/sysdeps/aarch64/libm-test-ulps @@ -41,6 +41,7 @@ float: 2 ldouble: 2 Function: "asin": +double: 1 float: 1 ldouble: 1 @@ -55,7 +56,7 @@ float: 1 ldouble: 1 Function: "asin_upward": -double: 1 +double: 2 float: 1 ldouble: 2 diff --git a/sysdeps/ieee754/dbl-64/e_asin.c b/sysdeps/ieee754/dbl-64/e_asin.c index 8a3b26f6645b66818ad0a57fe833355a3e9961e6..c01e8a34517e4a33f126bbab5c132379b4b58a4d 100644 --- a/sysdeps/ieee754/dbl-64/e_asin.c +++ b/sysdeps/ieee754/dbl-64/e_asin.c @@ -21,8 +21,7 @@ /* */ /* FUNCTIONS: uasin */ /* uacos */ -/* FILES NEEDED: dla.h endian.h mpa.h mydefs.h usncs.h */ -/* doasin.c sincos32.c dosincos.c mpa.c */ +/* FILES NEEDED: dla.h endian.h mydefs.h usncs.h */ /* sincos.tbl asincos.tbl powtwo.tbl root.tbl */ /* */ /******************************************************************/ @@ -31,7 +30,6 @@ #include "asincos.tbl" #include "root.tbl" #include "powtwo.tbl" -#include "MathLib.h" #include "uasncs.h" #include #include @@ -43,15 +41,10 @@ # define SECTION #endif -void __doasin(double x, double dx, double w[]); -void __dubsin(double x, double dx, double v[]); -void __dubcos(double x, double dx, double v[]); -void __docos(double x, double dx, double v[]); - double SECTION __ieee754_asin(double x){ - double x1,x2,xx,s1,s2,res1,p,t,res,r,cor,cc,y,c,z,w[2]; + double x2,xx,res1,p,t,res,r,cor,cc,y,c,z; mynumber u,v; int4 k,m,n; @@ -70,27 +63,8 @@ __ieee754_asin(double x){ x2 = x*x; t = (((((f6*x2 + f5)*x2 + f4)*x2 + f3)*x2 + f2)*x2 + f1)*(x2*x); res = x+t; /* res=arcsin(x) according to Taylor series */ - cor = (x-res)+t; - if (res == res+1.025*cor) return res; - else { - x1 = x+big; - xx = x*x; - x1 -= big; - x2 = x - x1; - p = x1*x1*x1; - s1 = a1.x*p; - s2 = ((((((c7*xx + c6)*xx + c5)*xx + c4)*xx + c3)*xx + c2)*xx*xx*x + - ((a1.x+a2.x)*x2*x2+ 0.5*x1*x)*x2) + a2.x*p; - res1 = x+s1; - s2 = ((x-res1)+s1)+s2; - res = res1+s2; - cor = (res1-res)+s2; - if (res == res+1.00014*cor) return res; - else { - __doasin(x,0,w); - return w[0]; - } - } + /* Max ULP is 0.512. */ + return res; } /*---------------------0.125 <= |x| < 0.5 -----------------------------*/ else if (k < 0x3fe00000) { @@ -103,26 +77,8 @@ __ieee754_asin(double x){ +xx*asncs.x[n+6]))))+asncs.x[n+7]; t+=p; res =asncs.x[n+8] +t; - cor = (asncs.x[n+8]-res)+t; - if (res == res+1.05*cor) return (m>0)?res:-res; - else { - r=asncs.x[n+8]+xx*asncs.x[n+9]; - t=((asncs.x[n+8]-r)+xx*asncs.x[n+9])+(p+xx*asncs.x[n+10]); - res = r+t; - cor = (r-res)+t; - if (res == res+1.0005*cor) return (m>0)?res:-res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - __dubsin(res,z,w); - z=(w[0]-fabs(x))+w[1]; - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1); - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1); - else { - return (m>0)?res:-res; - } - } - } + /* Max ULP is 0.523. */ + return (m>0)?res:-res; } /* else if (k < 0x3fe00000) */ /*-------------------- 0.5 <= |x| < 0.75 -----------------------------*/ else @@ -135,26 +91,8 @@ __ieee754_asin(double x){ +xx*(asncs.x[n+6]+xx*asncs.x[n+7])))))+asncs.x[n+8]; t+=p; res =asncs.x[n+9] +t; - cor = (asncs.x[n+9]-res)+t; - if (res == res+1.01*cor) return (m>0)?res:-res; - else { - r=asncs.x[n+9]+xx*asncs.x[n+10]; - t=((asncs.x[n+9]-r)+xx*asncs.x[n+10])+(p+xx*asncs.x[n+11]); - res = r+t; - cor = (r-res)+t; - if (res == res+1.0005*cor) return (m>0)?res:-res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - __dubsin(res,z,w); - z=(w[0]-fabs(x))+w[1]; - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1); - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1); - else { - return (m>0)?res:-res; - } - } - } + /* Max ULP is 0.505. */ + return (m>0)?res:-res; } /* else if (k < 0x3fe80000) */ /*--------------------- 0.75 <= |x|< 0.921875 ----------------------*/ else @@ -167,28 +105,8 @@ __ieee754_asin(double x){ +xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+xx*asncs.x[n+8]))))))+asncs.x[n+9]; t+=p; res =asncs.x[n+10] +t; - cor = (asncs.x[n+10]-res)+t; - if (res == res+1.01*cor) return (m>0)?res:-res; - else { - r=asncs.x[n+10]+xx*asncs.x[n+11]; - t=((asncs.x[n+10]-r)+xx*asncs.x[n+11])+(p+xx*asncs.x[n+12]); - res = r+t; - cor = (r-res)+t; - if (res == res+1.0008*cor) return (m>0)?res:-res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - y=hp0.x-res; - z=((hp0.x-y)-res)+(hp1.x-z); - __dubcos(y,z,w); - z=(w[0]-fabs(x))+w[1]; - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1); - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1); - else { - return (m>0)?res:-res; - } - } - } + /* Max ULP is 0.505. */ + return (m>0)?res:-res; } /* else if (k < 0x3fed8000) */ /*-------------------0.921875 <= |x| < 0.953125 ------------------------*/ else @@ -203,29 +121,8 @@ __ieee754_asin(double x){ xx*asncs.x[n+9])))))))+asncs.x[n+10]; t+=p; res =asncs.x[n+11] +t; - cor = (asncs.x[n+11]-res)+t; - if (res == res+1.01*cor) return (m>0)?res:-res; - else { - r=asncs.x[n+11]+xx*asncs.x[n+12]; - t=((asncs.x[n+11]-r)+xx*asncs.x[n+12])+(p+xx*asncs.x[n+13]); - res = r+t; - cor = (r-res)+t; - if (res == res+1.0007*cor) return (m>0)?res:-res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - y=(hp0.x-res)-z; - z=y+hp1.x; - y=(y-z)+hp1.x; - __dubcos(z,y,w); - z=(w[0]-fabs(x))+w[1]; - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1); - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1); - else { - return (m>0)?res:-res; - } - } - } + /* Max ULP is 0.505. */ + return (m>0)?res:-res; } /* else if (k < 0x3fee8000) */ /*--------------------0.953125 <= |x| < 0.96875 ------------------------*/ @@ -241,29 +138,8 @@ __ieee754_asin(double x){ xx*(asncs.x[n+9]+xx*asncs.x[n+10]))))))))+asncs.x[n+11]; t+=p; res =asncs.x[n+12] +t; - cor = (asncs.x[n+12]-res)+t; - if (res == res+1.01*cor) return (m>0)?res:-res; - else { - r=asncs.x[n+12]+xx*asncs.x[n+13]; - t=((asncs.x[n+12]-r)+xx*asncs.x[n+13])+(p+xx*asncs.x[n+14]); - res = r+t; - cor = (r-res)+t; - if (res == res+1.0007*cor) return (m>0)?res:-res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - y=(hp0.x-res)-z; - z=y+hp1.x; - y=(y-z)+hp1.x; - __dubcos(z,y,w); - z=(w[0]-fabs(x))+w[1]; - if (z>1.0e-27) return (m>0)?min(res,res1):-min(res,res1); - else if (z<-1.0e-27) return (m>0)?max(res,res1):-max(res,res1); - else { - return (m>0)?res:-res; - } - } - } + /* Max ULP is 0.505. */ + return (m>0)?res:-res; } /* else if (k < 0x3fef0000) */ /*--------------------0.96875 <= |x| < 1 --------------------------------*/ else @@ -282,16 +158,8 @@ __ieee754_asin(double x){ cor = (hp1.x - 2.0*cc)-2.0*(y+cc)*p; res1 = hp0.x - 2.0*y; res =res1 + cor; - if (res == res+1.003*((res1-res)+cor)) return (m>0)?res:-res; - else { - c=y+cc; - cc=(y-c)+cc; - __doasin(c,cc,w); - res1=hp0.x-2.0*w[0]; - cor=((hp0.x-res1)-2.0*w[0])+(hp1.x-2.0*w[1]); - res = res1+cor; - return (m>0)?res:-res; - } + /* Max ULP is 0.5015. */ + return (m>0)?res:-res; } /* else if (k < 0x3ff00000) */ /*---------------------------- |x|>=1 -------------------------------*/ else if (k==0x3ff00000 && u.i[LOW_HALF]==0) return (m>0)?hp0.x:-hp0.x; @@ -319,7 +187,7 @@ double SECTION __ieee754_acos(double x) { - double x1,x2,xx,s1,s2,res1,p,t,res,r,cor,cc,y,c,z,w[2],eps; + double x2,xx,res1,p,t,res,r,cor,cc,y,c,z; mynumber u,v; int4 k,m,n; u.x = x; @@ -336,32 +204,8 @@ __ieee754_acos(double x) r=hp0.x-x; cor=(((hp0.x-r)-x)+hp1.x)-t; res = r+cor; - cor = (r-res)+cor; - if (res == res+1.004*cor) return res; - else { - x1 = x+big; - xx = x*x; - x1 -= big; - x2 = x - x1; - p = x1*x1*x1; - s1 = a1.x*p; - s2 = ((((((c7*xx + c6)*xx + c5)*xx + c4)*xx + c3)*xx + c2)*xx*xx*x + - ((a1.x+a2.x)*x2*x2+ 0.5*x1*x)*x2) + a2.x*p; - res1 = x+s1; - s2 = ((x-res1)+s1)+s2; - r=hp0.x-res1; - cor=(((hp0.x-r)-res1)+hp1.x)-s2; - res = r+cor; - cor = (r-res)+cor; - if (res == res+1.00004*cor) return res; - else { - __doasin(x,0,w); - r=hp0.x-w[0]; - cor=((hp0.x-r)-w[0])+(hp1.x-w[1]); - res=r+cor; - return res; - } - } + /* Max ULP is 0.502. */ + return res; } /* else if (k < 0x3fc00000) */ /*---------------------- 0.125 <= |x| < 0.5 --------------------*/ else @@ -377,35 +221,16 @@ __ieee754_acos(double x) y = (m>0)?(hp0.x-asncs.x[n+8]):(hp0.x+asncs.x[n+8]); t = (m>0)?(hp1.x-t):(hp1.x+t); res = y+t; - if (res == res+1.02*((y-res)+t)) return res; - else { - r=asncs.x[n+8]+xx*asncs.x[n+9]; - t=((asncs.x[n+8]-r)+xx*asncs.x[n+9])+(p+xx*asncs.x[n+10]); - if (m>0) - {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; } - else - {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); } - res = p+t; - cor = (p-res)+t; - if (res == (res+1.0002*cor)) return res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - __docos(res,z,w); - z=(w[0]-x)+w[1]; - if (z>1.0e-27) return max(res,res1); - else if (z<-1.0e-27) return min(res,res1); - else return res; - } - } + /* Max ULP is 0.51. */ + return res; } /* else if (k < 0x3fe00000) */ /*--------------------------- 0.5 <= |x| < 0.75 ---------------------*/ else if (k < 0x3fe80000) { n = 1056+((k&0x000fe000)>>11)*3; - if (m>0) {xx = x - asncs.x[n]; eps=1.04; } - else {xx = -x - asncs.x[n]; eps=1.02; } + if (m>0) {xx = x - asncs.x[n]; } + else {xx = -x - asncs.x[n]; } t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+ @@ -414,33 +239,16 @@ __ieee754_acos(double x) y = (m>0)?(hp0.x-asncs.x[n+9]):(hp0.x+asncs.x[n+9]); t = (m>0)?(hp1.x-t):(hp1.x+t); res = y+t; - if (res == res+eps*((y-res)+t)) return res; - else { - r=asncs.x[n+9]+xx*asncs.x[n+10]; - t=((asncs.x[n+9]-r)+xx*asncs.x[n+10])+(p+xx*asncs.x[n+11]); - if (m>0) {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; eps=1.0004; } - else {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); eps=1.0002; } - res = p+t; - cor = (p-res)+t; - if (res == (res+eps*cor)) return res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - __docos(res,z,w); - z=(w[0]-x)+w[1]; - if (z>1.0e-27) return max(res,res1); - else if (z<-1.0e-27) return min(res,res1); - else return res; - } - } + /* Max ULP is 0.52. */ + return res; } /* else if (k < 0x3fe80000) */ /*------------------------- 0.75 <= |x| < 0.921875 -------------*/ else if (k < 0x3fed8000) { n = 992+((k&0x000fe000)>>13)*13; - if (m>0) {xx = x - asncs.x[n]; eps = 1.04; } - else {xx = -x - asncs.x[n]; eps = 1.01; } + if (m>0) {xx = x - asncs.x[n]; } + else {xx = -x - asncs.x[n]; } t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+ @@ -449,33 +257,16 @@ __ieee754_acos(double x) y = (m>0)?(hp0.x-asncs.x[n+10]):(hp0.x+asncs.x[n+10]); t = (m>0)?(hp1.x-t):(hp1.x+t); res = y+t; - if (res == res+eps*((y-res)+t)) return res; - else { - r=asncs.x[n+10]+xx*asncs.x[n+11]; - t=((asncs.x[n+10]-r)+xx*asncs.x[n+11])+(p+xx*asncs.x[n+12]); - if (m>0) {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; eps=1.0032; } - else {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); eps=1.0008; } - res = p+t; - cor = (p-res)+t; - if (res == (res+eps*cor)) return res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - __docos(res,z,w); - z=(w[0]-x)+w[1]; - if (z>1.0e-27) return max(res,res1); - else if (z<-1.0e-27) return min(res,res1); - else return res; - } - } + /* Max ULP is 0.52. */ + return res; } /* else if (k < 0x3fed8000) */ /*-------------------0.921875 <= |x| < 0.953125 ------------------*/ else if (k < 0x3fee8000) { n = 884+((k&0x000fe000)>>13)*14; - if (m>0) {xx = x - asncs.x[n]; eps=1.04; } - else {xx = -x - asncs.x[n]; eps =1.005; } + if (m>0) {xx = x - asncs.x[n]; } + else {xx = -x - asncs.x[n]; } t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6] @@ -485,33 +276,16 @@ __ieee754_acos(double x) y = (m>0)?(hp0.x-asncs.x[n+11]):(hp0.x+asncs.x[n+11]); t = (m>0)?(hp1.x-t):(hp1.x+t); res = y+t; - if (res == res+eps*((y-res)+t)) return res; - else { - r=asncs.x[n+11]+xx*asncs.x[n+12]; - t=((asncs.x[n+11]-r)+xx*asncs.x[n+12])+(p+xx*asncs.x[n+13]); - if (m>0) {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; eps=1.0030; } - else {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); eps=1.0005; } - res = p+t; - cor = (p-res)+t; - if (res == (res+eps*cor)) return res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - __docos(res,z,w); - z=(w[0]-x)+w[1]; - if (z>1.0e-27) return max(res,res1); - else if (z<-1.0e-27) return min(res,res1); - else return res; - } - } + /* Max ULP is 0.52. */ + return res; } /* else if (k < 0x3fee8000) */ /*--------------------0.953125 <= |x| < 0.96875 ----------------*/ else if (k < 0x3fef0000) { n = 768+((k&0x000fe000)>>13)*15; - if (m>0) {xx = x - asncs.x[n]; eps=1.04; } - else {xx = -x - asncs.x[n]; eps=1.005;} + if (m>0) {xx = x - asncs.x[n]; } + else {xx = -x - asncs.x[n]; } t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ xx*(asncs.x[n+5]+xx*(asncs.x[n+6] @@ -521,25 +295,8 @@ __ieee754_acos(double x) y = (m>0)?(hp0.x-asncs.x[n+12]):(hp0.x+asncs.x[n+12]); t = (m>0)?(hp1.x-t):(hp1.x+t); res = y+t; - if (res == res+eps*((y-res)+t)) return res; - else { - r=asncs.x[n+12]+xx*asncs.x[n+13]; - t=((asncs.x[n+12]-r)+xx*asncs.x[n+13])+(p+xx*asncs.x[n+14]); - if (m>0) {p = hp0.x-r; t = (((hp0.x-p)-r)-t)+hp1.x; eps=1.0030; } - else {p = hp0.x+r; t = ((hp0.x-p)+r)+(hp1.x+t); eps=1.0005; } - res = p+t; - cor = (p-res)+t; - if (res == (res+eps*cor)) return res; - else { - res1=res+1.1*cor; - z=0.5*(res1-res); - __docos(res,z,w); - z=(w[0]-x)+w[1]; - if (z>1.0e-27) return max(res,res1); - else if (z<-1.0e-27) return min(res,res1); - else return res; - } - } + /* Max ULP is 0.52. */ + return res; } /* else if (k < 0x3fef0000) */ /*-----------------0.96875 <= |x| < 1 ---------------------------*/ @@ -560,28 +317,14 @@ __ieee754_acos(double x) cor = (hp1.x - cc)-(y+cc)*p; res1 = hp0.x - y; res =res1 + cor; - if (res == res+1.002*((res1-res)+cor)) return (res+res); - else { - c=y+cc; - cc=(y-c)+cc; - __doasin(c,cc,w); - res1=hp0.x-w[0]; - cor=((hp0.x-res1)-w[0])+(hp1.x-w[1]); - res = res1+cor; - return (res+res); - } + /* Max ULP is 0.501. */ + return (res+res); } else { cor = cc+p*(y+cc); res = y + cor; - if (res == res+1.03*((y-res)+cor)) return (res+res); - else { - c=y+cc; - cc=(y-c)+cc; - __doasin(c,cc,w); - res = w[0]; - return (res+res); - } + /* Max ULP is 0.515. */ + return (res+res); } } /* else if (k < 0x3ff00000) */ From patchwork Mon Jan 4 12:17:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 41620 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2FF8238708F8; Mon, 4 Jan 2021 12:18:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FF8238708F8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609762710; bh=7REow1MRwlCI2/FnBei9LbJ6NxS7yoc+PW6Xbgz3+9Y=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=T/vlhTnw9H+050frwUvERCrUNB/t0P8iwU7CdFORCLSlaTKZrSfPyP9mLzt2FN9CR w2nZlsn4ybcc6dD4HtY2D/eprICt+p+Jtvbku/G/6YbFMU8rLzT9MbaxdRKHwjavWs xwmT6eiiYQae/DPVo8KHD4n4mXYwog9ku22c73+o= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2043.outbound.protection.outlook.com [40.107.20.43]) by sourceware.org (Postfix) with ESMTPS id 79B9638708C8 for ; Mon, 4 Jan 2021 12:18:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 79B9638708C8 Received: from DB6PR0501CA0036.eurprd05.prod.outlook.com (2603:10a6:4:67::22) by VI1PR08MB3453.eurprd08.prod.outlook.com (2603:10a6:803:80::26) 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:18:22 +0000 Received: from DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:67:cafe::c0) by DB6PR0501CA0036.outlook.office365.com (2603:10a6:4:67::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.19 via Frontend Transport; Mon, 4 Jan 2021 12:18:22 +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 DB5EUR03FT010.mail.protection.outlook.com (10.152.20.96) 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:18:22 +0000 Received: ("Tessian outbound 6ec21dac9dd3:v71"); Mon, 04 Jan 2021 12:18:22 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 87a8ee2470361828 X-CR-MTA-TID: 64aa7808 Received: from 3fda6df284c6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8496AAFB-C032-4686-9C39-AD0E9280BFA3.1; Mon, 04 Jan 2021 12:17:44 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3fda6df284c6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 04 Jan 2021 12:17:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AkFMH1wESrNKd1iG92Js2nliL+ZnJuLq6Qfu1uCLyqh6SeyRhZv/UAz4IcveHfb64rSWclh+/cbjt9/u8OcVre+3aFgqyynIMYSW8bRNxF+4N02HKhmUxs9jem+OM0XK2FthM18wxJjMf09T60pa9AieQe99aHu3e514CAE60QMy82iWuub55aZhH4pmJKQyCHmvcs07lPCE7wuFjfJVMh7j8ZjKHwO8zdd5rlGgUFBujt7kKvMZ3s/FcLwG9Pad8OZlisRXn5DjxkvwLxdiBHkTlX2Hu81FDNVjCn+7XONLUjB1dXxagd0eTBsExg6D4aN/wZdbsAZBFxg/tGDdyg== 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=7REow1MRwlCI2/FnBei9LbJ6NxS7yoc+PW6Xbgz3+9Y=; b=WBl1YmYb/8TN6F5hsy6+8fflw4qJ1EXmuHe1Uv6lkJIrYTbOAZxowduCSg/W9OSFTkmw5nK7FUe6Y8VXDyi0c5bJibRbKcbdXVl4lD3HZrYPuPNJK9owEXtuAAy2O2xfLDFUBmq8cRIOHSCGZrVQ7t9TsBvxFR+xqBSVqBdrj1DOvXiHCeykOb1REfiUwsJo9Fez5RHWOVKnepTVoaL/RHxRQ7pbddu9XRGwA1wgVmfdAqzAiDwizVZ9dBrf3JKC54SIThj9qPHbCYo1F23uqnNGrkMYPucWSuSi50qKAhqiGy8P5HuLK0OuYqtwcKWAYJT639tZWMIXco05ezY6YA== 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:17:41 +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:17:41 +0000 To: 'GNU C Library' Subject: [PATCH 2/5] Remove slow paths in tan Thread-Topic: [PATCH 2/5] Remove slow paths in tan Thread-Index: AQHW4pOZLNGd5UXFY0SUPNIHlSMyKw== Date: Mon, 4 Jan 2021 12:17:41 +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: 066595f8-7d23-43fc-4cc9-08d8b0aad405 x-ms-traffictypediagnostic: VE1PR08MB4718:|VI1PR08MB3453: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:120;OLM:120; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: WqFZs2FebxW4Qu48IxMFAgyWTJdw6Q0wvRNJ8QTwwYa3QorT/eWw1+ZwIYTgzYCtA67LG6PpY1YMs54t0p2qG6h3zFIAA6UkWXc+c1lA/z27fwV4KLAbTKyvS/4owx+NXcNOWp4QPJ9kKDZlBN8GMwbAxuvIBftchmEpa8zLC7KgB3njdQ3SCDbHdO3miKLn3D6B1bC0F+cB8OAtEqB1VCijUUTpET9ZvavIDhgu4h8wHLZhhkmSuhHA/MHpIT5gymlxeJv292jwmP9vlk+gXWcoFpfsJMMnwfe+pmx1g+kayKxQsDSC+1tv4P3iOnB+kw9FE9VKEjN6fZD9xKij0Vpb1ejZWguO+ZdJGYk6ZG4dtLechK0NOz0C+97AlH3Rq7mHwnoSppzRYRU/0ma9iQ== 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)(559001)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?q?0LF1c4wjFRnb9xXratKOd4CsM?= =?iso-8859-1?q?uXCfoar9YZKY7iAzg78TpiOJTb6Ftw8ZDaIU86UokoPjJK+bqjR+Slteq5Au?= =?iso-8859-1?q?rmk8IC5MLnmK6QSIBmnDIumHynCeI566lLDy3eK6u/p3Ynmi3BO4IbPivf5N?= =?iso-8859-1?q?nDfScQ1NPycJgNNRFyvE0PjzYwQhq1RAFmZZtrs3x9JKcuSxT7LeNu2EBSjz?= =?iso-8859-1?q?laDfG3EUcRkXYqCLpBrfFlAJJfH6fL8QIKdKBeVIg0fWQs3wGPHJeyDtsdyH?= =?iso-8859-1?q?XoZGaCzP4uslXkjVwgvQL+JOY7xViVHQF13YuQqvTz2tKTogiEk9RI3DnlQ+?= =?iso-8859-1?q?XgSSzq7b5FpRJe2LQtDQ/NyqUIhLu5e/wzUWIOXqCLdSJ/Q2g2V+N6g2TxJK?= =?iso-8859-1?q?JeBqHG7huTu+Q8Y09KUAosSSjfIdODULeU1BmYlhzlIWxYmVPmIamjMRGLZu?= =?iso-8859-1?q?udstgFP724pl0yzJVsPYHoQRnWCTYp3hBi3gDUE0gFCUZul33KFzxeKZgPDl?= =?iso-8859-1?q?l8uyC4v6kxWupnvQYKHYE2jr3EaJf8zplqwh3McK8c6kXFK1/iiEnNE5THgh?= =?iso-8859-1?q?wXFBfPAtWYnaozFxiNkiPdgN6Np9ixUfgHQ04rZjXbzcrRRLA82lvsXf7vFb?= =?iso-8859-1?q?qd/cxbDTmP+dp8Y7Eprlp+235ANPFb4/NBJajUj37lPZIKkTGJZ5b8xOyYYs?= =?iso-8859-1?q?tU4rk+JRcs2dpl1I2l3aebJVpZZBjF+3upy55Cp15mvSvt9OQsHTxtfqoOnh?= =?iso-8859-1?q?1ZPW/xzabMjd1Efz5LCdlX6PTz3qztxpojok4kaIbRU/sxcMLEP/Ln5aUbeu?= =?iso-8859-1?q?I9re898FRZjcsuL+ytqR29nKZ3UAFm6VLjeDKaQkIDiYPYmU41uDRwpocYdo?= =?iso-8859-1?q?6B93kptA5oqnr9a4Vjwboe0EaKp/pSZh6LWJtAgTpfcEKDWWT+MGzGw1Md58?= =?iso-8859-1?q?bPEJ8BKeQ3yLtwu8ZJU2tvtnQG69UZuxppSPiGF1Fxanx8lSPLBJBl4b3rgG?= =?iso-8859-1?q?tHHX20klKZcF2MFwzw=3D?= x-ms-exchange-transport-forked: True 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: DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ec7888f7-6c4a-4ba6-ae15-08d8b0aabbe1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZYrEs0FjYhWrjbdxzAbJfC4HK3d3bXMZX8qdmxZoHEjmsIYDX+ibD9FAWTB6wIJleEAtih2BHucKbs9FCJsBzulHthUtZlOi6aU/llZ4wt0AmVinhOREawWJtZawIFndJBfyBDjH0+wi41gh/W8txMzC3/sCHaulL/xb8JkQYa7IQcV0yytBwp48urfOQuR69f6eh++cOMpDhSHWVoW0U+iy0Rl70YD4rARBGnbsWxCDZx8ARc5t51aVphZnSXfFRPOVZdTRubYPw7VNQrYQoLf+ZxRel6LPVkbTyNCEBtfEhG2uLrFC+x/B+zixfIrqiLn8A3GJVfZP7QMZ90b1VNQeMv5Td7HgMntCVPJSRF5Mjv3Sh+2g61zwVsTkdXQE2Ot/Ept1rPmRb8URoAraDur5UQho3pu59vO1XL8KnMV0olO/AtkAs099VarHnyxRqX1dlzcyUDCUP1Z4mX8TPA== 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)(376002)(39860400002)(346002)(396003)(46966006)(7696005)(82740400003)(9686003)(81166007)(55016002)(82310400003)(8936002)(2940100002)(478600001)(52536014)(86362001)(70206006)(33656002)(316002)(30864003)(356005)(8676002)(6916009)(5660300002)(336012)(6506007)(2906002)(26005)(186003)(83380400001)(70586007)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2021 12:18:22.0896 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 066595f8-7d23-43fc-4cc9-08d8b0aad405 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: DB5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3453 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SCC_10_SHORT_WORD_LINES, 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-Patchwork-Original-From: Wilco Dijkstra via Libc-alpha From: Wilco Dijkstra Reply-To: Wilco Dijkstra Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Remove slow paths in tan. Add ULP annotations. Merge 'number' into 'mynumber'. Remove unused entries from tan constants. Passes GLIBC testsuite. diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c index 380d34368dbdf95138aed911677bdc29ac1e7d9b..7af2a4f495d39f6450699de1d0d9d2f7a33fdcf7 100644 --- a/sysdeps/ieee754/dbl-64/e_atan2.c +++ b/sysdeps/ieee754/dbl-64/e_atan2.c @@ -39,6 +39,7 @@ #include #include "mpa.h" #include "MathLib.h" +#include "mydefs.h" #include "uatan.tbl" #include "atnat2.h" #include diff --git a/sysdeps/ieee754/dbl-64/mydefs.h b/sysdeps/ieee754/dbl-64/mydefs.h index 60aa2401e02d31524d0890c31987dfd9736ed25a..f17f4f593ca3819d3cbc03bb6138d483743982e8 100644 --- a/sysdeps/ieee754/dbl-64/mydefs.h +++ b/sysdeps/ieee754/dbl-64/mydefs.h @@ -28,7 +28,7 @@ #define MY_H typedef int int4; -typedef union { int4 i[2]; double x; } mynumber; +typedef union { int4 i[2]; double x; double d; } mynumber; #define max(x, y) (((y) > (x)) ? (y) : (x)) #define min(x, y) (((y) < (x)) ? (y) : (x)) diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c index 086ae50458a3b1cd5826f61b736ea609d9d72ee9..1c5f32711eb31e99f2f1b4372b200bbe520efe57 100644 --- a/sysdeps/ieee754/dbl-64/s_tan.c +++ b/sysdeps/ieee754/dbl-64/s_tan.c @@ -20,40 +20,29 @@ /* MODULE_NAME: utan.c */ /* */ /* FUNCTIONS: utan */ -/* tanMp */ /* */ -/* FILES NEEDED:dla.h endian.h mpa.h mydefs.h utan.h */ -/* branred.c sincos32.c mptan.c */ +/* FILES NEEDED:dla.h endian.h mydefs.h utan.h */ +/* branred.c */ /* utan.tbl */ /* */ -/* An ultimate tan routine. Given an IEEE double machine number x */ -/* it computes the correctly rounded (to nearest) value of tan(x). */ -/* Assumption: Machine arithmetic operations are performed in */ -/* round to nearest mode of IEEE 754 standard. */ -/* */ /*********************************************************************/ #include #include #include "endian.h" #include -#include "mpa.h" -#include "MathLib.h" +#include "mydefs.h" #include #include #include #include #include #include -#include #ifndef SECTION # define SECTION #endif -static double tanMp (double); -void __mptan (double, mp_no *, int); - double SECTION __tan (double x) @@ -62,17 +51,14 @@ __tan (double x) #include "utan.tbl" int ux, i, n; - double a, da, a2, b, db, c, dc, c1, cc1, c2, cc2, c3, cc3, fi, ffi, gi, pz, - s, sy, t, t1, t2, t3, t4, w, x2, xn, xx2, y, ya, - yya, z0, z, zz, z2, zz2; - int p; - number num, v; - mp_no mpa, mpt1, mpt2; + double a, da, a2, b, db, c, dc, fi, gi, pz, + s, sy, t, t1, t2, t3, t4, w, x2, xn, y, ya, + yya, z0, z, z2; + mynumber num, v; double retval; int __branred (double, double *, double *); - int __mpranred (double, mp_no *, int); SET_RESTORE_ROUND_53BIT (FE_TONEAREST); @@ -100,7 +86,6 @@ __tan (double x) /* (II) The case 1.259e-8 < abs(x) <= 0.0608 */ if (w <= g2.d) { - /* First stage */ x2 = x * x; t2 = d9.d + x2 * d11.d; @@ -109,50 +94,16 @@ __tan (double x) t2 = d3.d + x2 * t2; t2 *= x * x2; - if ((y = x + (t2 - u1.d * t2)) == x + (t2 + u1.d * t2)) - { - retval = y; - goto ret; - } - - /* Second stage */ - c1 = a25.d + x2 * a27.d; - c1 = a23.d + x2 * c1; - c1 = a21.d + x2 * c1; - c1 = a19.d + x2 * c1; - c1 = a17.d + x2 * c1; - c1 = a15.d + x2 * c1; - c1 *= x2; - - EMULV (x, x, x2, xx2); - ADD2 (a13.d, aa13.d, c1, 0.0, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a11.d, aa11.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a9.d, aa9.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a7.d, aa7.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a5.d, aa5.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a3.d, aa3.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - MUL2 (x, 0.0, c1, cc1, c2, cc2, t1, t2); - ADD2 (x, 0.0, c2, cc2, c1, cc1, t1, t2); - if ((y = c1 + (cc1 - u2.d * c1)) == c1 + (cc1 + u2.d * c1)) - { - retval = y; - goto ret; - } - retval = tanMp (x); + y = x + t2; + retval = y; + /* Max ULP is 0.504. */ goto ret; } /* (III) The case 0.0608 < abs(x) <= 0.787 */ if (w <= g3.d) { - /* First stage */ - i = ((int) (mfftnhf.d + TWO8 * w)); + i = ((int) (mfftnhf.d + 256 * w)); z = w - xfg[i][0].d; z2 = z * z; s = (x < 0.0) ? -1 : 1; @@ -160,41 +111,9 @@ __tan (double x) fi = xfg[i][1].d; gi = xfg[i][2].d; t2 = pz * (gi + fi) / (gi - pz); - if ((y = fi + (t2 - fi * u3.d)) == fi + (t2 + fi * u3.d)) - { - retval = (s * y); - goto ret; - } - t3 = (t2 < 0.0) ? -t2 : t2; - t4 = fi * ua3.d + t3 * ub3.d; - if ((y = fi + (t2 - t4)) == fi + (t2 + t4)) - { - retval = (s * y); - goto ret; - } - - /* Second stage */ - ffi = xfg[i][3].d; - c1 = z2 * (a7.d + z2 * (a9.d + z2 * a11.d)); - EMULV (z, z, z2, zz2); - ADD2 (a5.d, aa5.d, c1, 0.0, c2, cc2, t1, t2); - MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a3.d, aa3.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2); - MUL2 (z, 0.0, c1, cc1, c2, cc2, t1, t2); - ADD2 (z, 0.0, c2, cc2, c1, cc1, t1, t2); - - ADD2 (fi, ffi, c1, cc1, c2, cc2, t1, t2); - MUL2 (fi, ffi, c1, cc1, c3, cc3, t1, t2); - SUB2 (1.0, 0.0, c3, cc3, c1, cc1, t1, t2); - DIV2 (c2, cc2, c1, cc1, c3, cc3, t1, t2, t3, t4); - - if ((y = c3 + (cc3 - u4.d * c3)) == c3 + (cc3 + u4.d * c3)) - { - retval = (s * y); - goto ret; - } - retval = tanMp (x); + y = fi + t2; + retval = (s * y); + /* Max ULP is 0.60. */ goto ret; } @@ -223,14 +142,7 @@ __tan (double x) sy = 1; } - /* (IV),(V) The case 0.787 < abs(x) <= 25, abs(y) <= 1e-7 */ - if (ya <= gy1.d) - { - retval = tanMp (x); - goto ret; - } - - /* (VI) The case 0.787 < abs(x) <= 25, 1e-7 < abs(y) <= 0.0608 */ + /* (VI) The case 0.787 < abs(x) <= 25, 0 < abs(y) <= 0.0608 */ if (ya <= gy2.d) { a2 = a * a; @@ -242,94 +154,27 @@ __tan (double x) if (n) { - /* First stage -cot */ + /* -cot */ EADD (a, t2, b, db); DIV2 (1.0, 0.0, b, db, c, dc, t1, t2, t3, t4); - if ((y = c + (dc - u6.d * c)) == c + (dc + u6.d * c)) - { - retval = (-y); - goto ret; - } - } - else - { - /* First stage tan */ - if ((y = a + (t2 - u5.d * a)) == a + (t2 + u5.d * a)) - { - retval = y; - goto ret; - } - } - /* Second stage */ - /* Range reduction by algorithm ii */ - t = (x * hpinv.d + toint.d); - xn = t - toint.d; - v.d = t; - t1 = (x - xn * mp1.d) - xn * mp2.d; - n = v.i[LOW_HALF] & 0x00000001; - da = xn * pp3.d; - t = t1 - da; - da = (t1 - t) - da; - t1 = xn * pp4.d; - a = t - t1; - da = ((t - a) - t1) + da; - - /* Second stage */ - EADD (a, da, t1, t2); - a = t1; - da = t2; - MUL2 (a, da, a, da, x2, xx2, t1, t2); - - c1 = a25.d + x2 * a27.d; - c1 = a23.d + x2 * c1; - c1 = a21.d + x2 * c1; - c1 = a19.d + x2 * c1; - c1 = a17.d + x2 * c1; - c1 = a15.d + x2 * c1; - c1 *= x2; - - ADD2 (a13.d, aa13.d, c1, 0.0, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a11.d, aa11.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a9.d, aa9.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a7.d, aa7.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a5.d, aa5.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a3.d, aa3.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - MUL2 (a, da, c1, cc1, c2, cc2, t1, t2); - ADD2 (a, da, c2, cc2, c1, cc1, t1, t2); - - if (n) - { - /* Second stage -cot */ - DIV2 (1.0, 0.0, c1, cc1, c2, cc2, t1, t2, t3, t4); - if ((y = c2 + (cc2 - u8.d * c2)) == c2 + (cc2 + u8.d * c2)) - { - retval = (-y); - goto ret; - } + y = c + dc; + retval = (-y); + /* Max ULP is 0.506. */ + goto ret; } else { - /* Second stage tan */ - if ((y = c1 + (cc1 - u7.d * c1)) == c1 + (cc1 + u7.d * c1)) - { - retval = y; - goto ret; - } + /* tan */ + y = a + t2; + retval = y; + /* Max ULP is 0.506. */ + goto ret; } - retval = tanMp (x); - goto ret; } /* (VII) The case 0.787 < abs(x) <= 25, 0.0608 < abs(y) <= 0.787 */ - /* First stage */ - i = ((int) (mfftnhf.d + TWO8 * ya)); + i = ((int) (mfftnhf.d + 256 * ya)); z = (z0 = (ya - xfg[i][0].d)) + yya; z2 = z * z; pz = z + z * z2 * (e0.d + z2 * e1.d); @@ -340,76 +185,20 @@ __tan (double x) { /* -cot */ t2 = pz * (fi + gi) / (fi + pz); - if ((y = gi - (t2 - gi * u10.d)) == gi - (t2 + gi * u10.d)) - { - retval = (-sy * y); - goto ret; - } - t3 = (t2 < 0.0) ? -t2 : t2; - t4 = gi * ua10.d + t3 * ub10.d; - if ((y = gi - (t2 - t4)) == gi - (t2 + t4)) - { - retval = (-sy * y); - goto ret; - } + y = gi - t2; + retval = (-sy * y); + /* Max ULP is 0.62. */ + goto ret; } else { /* tan */ t2 = pz * (gi + fi) / (gi - pz); - if ((y = fi + (t2 - fi * u9.d)) == fi + (t2 + fi * u9.d)) - { - retval = (sy * y); - goto ret; - } - t3 = (t2 < 0.0) ? -t2 : t2; - t4 = fi * ua9.d + t3 * ub9.d; - if ((y = fi + (t2 - t4)) == fi + (t2 + t4)) - { - retval = (sy * y); - goto ret; - } - } - - /* Second stage */ - ffi = xfg[i][3].d; - EADD (z0, yya, z, zz) - MUL2 (z, zz, z, zz, z2, zz2, t1, t2); - c1 = z2 * (a7.d + z2 * (a9.d + z2 * a11.d)); - ADD2 (a5.d, aa5.d, c1, 0.0, c2, cc2, t1, t2); - MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a3.d, aa3.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2); - MUL2 (z, zz, c1, cc1, c2, cc2, t1, t2); - ADD2 (z, zz, c2, cc2, c1, cc1, t1, t2); - - ADD2 (fi, ffi, c1, cc1, c2, cc2, t1, t2); - MUL2 (fi, ffi, c1, cc1, c3, cc3, t1, t2); - SUB2 (1.0, 0.0, c3, cc3, c1, cc1, t1, t2); - - if (n) - { - /* -cot */ - DIV2 (c1, cc1, c2, cc2, c3, cc3, t1, t2, t3, t4); - if ((y = c3 + (cc3 - u12.d * c3)) == c3 + (cc3 + u12.d * c3)) - { - retval = (-sy * y); - goto ret; - } - } - else - { - /* tan */ - DIV2 (c2, cc2, c1, cc1, c3, cc3, t1, t2, t3, t4); - if ((y = c3 + (cc3 - u11.d * c3)) == c3 + (cc3 + u11.d * c3)) - { - retval = (sy * y); - goto ret; - } + y = fi + t2; + retval = (sy * y); + /* Max ULP is 0.62. */ + goto ret; } - - retval = tanMp (x); - goto ret; } /* (---) The case 25 < abs(x) <= 1e8 */ @@ -443,14 +232,7 @@ __tan (double x) sy = 1; } - /* (+++) The case 25 < abs(x) <= 1e8, abs(y) <= 1e-7 */ - if (ya <= gy1.d) - { - retval = tanMp (x); - goto ret; - } - - /* (VIII) The case 25 < abs(x) <= 1e8, 1e-7 < abs(y) <= 0.0608 */ + /* (VIII) The case 25 < abs(x) <= 1e8, 0 < abs(y) <= 0.0608 */ if (ya <= gy2.d) { a2 = a * a; @@ -462,76 +244,26 @@ __tan (double x) if (n) { - /* First stage -cot */ + /* -cot */ EADD (a, t2, b, db); DIV2 (1.0, 0.0, b, db, c, dc, t1, t2, t3, t4); - if ((y = c + (dc - u14.d * c)) == c + (dc + u14.d * c)) - { - retval = (-y); - goto ret; - } - } - else - { - /* First stage tan */ - if ((y = a + (t2 - u13.d * a)) == a + (t2 + u13.d * a)) - { - retval = y; - goto ret; - } - } - - /* Second stage */ - MUL2 (a, da, a, da, x2, xx2, t1, t2); - c1 = a25.d + x2 * a27.d; - c1 = a23.d + x2 * c1; - c1 = a21.d + x2 * c1; - c1 = a19.d + x2 * c1; - c1 = a17.d + x2 * c1; - c1 = a15.d + x2 * c1; - c1 *= x2; - - ADD2 (a13.d, aa13.d, c1, 0.0, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a11.d, aa11.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a9.d, aa9.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a7.d, aa7.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a5.d, aa5.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a3.d, aa3.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - MUL2 (a, da, c1, cc1, c2, cc2, t1, t2); - ADD2 (a, da, c2, cc2, c1, cc1, t1, t2); - - if (n) - { - /* Second stage -cot */ - DIV2 (1.0, 0.0, c1, cc1, c2, cc2, t1, t2, t3, t4); - if ((y = c2 + (cc2 - u16.d * c2)) == c2 + (cc2 + u16.d * c2)) - { - retval = (-y); - goto ret; - } + y = c + dc; + retval = (-y); + /* Max ULP is 0.506. */ + goto ret; } else { - /* Second stage tan */ - if ((y = c1 + (cc1 - u15.d * c1)) == c1 + (cc1 + u15.d * c1)) - { - retval = (y); - goto ret; - } + /* tan */ + y = a + t2; + retval = y; + /* Max ULP is 0.506. */ + goto ret; } - retval = tanMp (x); - goto ret; } /* (IX) The case 25 < abs(x) <= 1e8, 0.0608 < abs(y) <= 0.787 */ - /* First stage */ - i = ((int) (mfftnhf.d + TWO8 * ya)); + i = ((int) (mfftnhf.d + 256 * ya)); z = (z0 = (ya - xfg[i][0].d)) + yya; z2 = z * z; pz = z + z * z2 * (e0.d + z2 * e1.d); @@ -542,75 +274,20 @@ __tan (double x) { /* -cot */ t2 = pz * (fi + gi) / (fi + pz); - if ((y = gi - (t2 - gi * u18.d)) == gi - (t2 + gi * u18.d)) - { - retval = (-sy * y); - goto ret; - } - t3 = (t2 < 0.0) ? -t2 : t2; - t4 = gi * ua18.d + t3 * ub18.d; - if ((y = gi - (t2 - t4)) == gi - (t2 + t4)) - { - retval = (-sy * y); - goto ret; - } + y = gi - t2; + retval = (-sy * y); + /* Max ULP is 0.62. */ + goto ret; } else { /* tan */ t2 = pz * (gi + fi) / (gi - pz); - if ((y = fi + (t2 - fi * u17.d)) == fi + (t2 + fi * u17.d)) - { - retval = (sy * y); - goto ret; - } - t3 = (t2 < 0.0) ? -t2 : t2; - t4 = fi * ua17.d + t3 * ub17.d; - if ((y = fi + (t2 - t4)) == fi + (t2 + t4)) - { - retval = (sy * y); - goto ret; - } - } - - /* Second stage */ - ffi = xfg[i][3].d; - EADD (z0, yya, z, zz); - MUL2 (z, zz, z, zz, z2, zz2, t1, t2); - c1 = z2 * (a7.d + z2 * (a9.d + z2 * a11.d)); - ADD2 (a5.d, aa5.d, c1, 0.0, c2, cc2, t1, t2); - MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a3.d, aa3.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2); - MUL2 (z, zz, c1, cc1, c2, cc2, t1, t2); - ADD2 (z, zz, c2, cc2, c1, cc1, t1, t2); - - ADD2 (fi, ffi, c1, cc1, c2, cc2, t1, t2); - MUL2 (fi, ffi, c1, cc1, c3, cc3, t1, t2); - SUB2 (1.0, 0.0, c3, cc3, c1, cc1, t1, t2); - - if (n) - { - /* -cot */ - DIV2 (c1, cc1, c2, cc2, c3, cc3, t1, t2, t3, t4); - if ((y = c3 + (cc3 - u20.d * c3)) == c3 + (cc3 + u20.d * c3)) - { - retval = (-sy * y); - goto ret; - } - } - else - { - /* tan */ - DIV2 (c2, cc2, c1, cc1, c3, cc3, t1, t2, t3, t4); - if ((y = c3 + (cc3 - u19.d * c3)) == c3 + (cc3 + u19.d * c3)) - { - retval = (sy * y); - goto ret; - } + y = fi + t2; + retval = (sy * y); + /* Max ULP is 0.62. */ + goto ret; } - retval = tanMp (x); - goto ret; } /* (---) The case 1e8 < abs(x) < 2**1024 */ @@ -632,14 +309,7 @@ __tan (double x) sy = 1; } - /* (+++) The case 1e8 < abs(x) < 2**1024, abs(y) <= 1e-7 */ - if (ya <= gy1.d) - { - retval = tanMp (x); - goto ret; - } - - /* (X) The case 1e8 < abs(x) < 2**1024, 1e-7 < abs(y) <= 0.0608 */ + /* (X) The case 1e8 < abs(x) < 2**1024, 0 < abs(y) <= 0.0608 */ if (ya <= gy2.d) { a2 = a * a; @@ -650,85 +320,26 @@ __tan (double x) t2 = da + a * a2 * t2; if (n) { - /* First stage -cot */ + /* -cot */ EADD (a, t2, b, db); DIV2 (1.0, 0.0, b, db, c, dc, t1, t2, t3, t4); - if ((y = c + (dc - u22.d * c)) == c + (dc + u22.d * c)) - { - retval = (-y); - goto ret; - } - } - else - { - /* First stage tan */ - if ((y = a + (t2 - u21.d * a)) == a + (t2 + u21.d * a)) - { - retval = y; - goto ret; - } - } - - /* Second stage */ - /* Reduction by algorithm iv */ - p = 10; - n = (__mpranred (x, &mpa, p)) & 0x00000001; - __mp_dbl (&mpa, &a, p); - __dbl_mp (a, &mpt1, p); - __sub (&mpa, &mpt1, &mpt2, p); - __mp_dbl (&mpt2, &da, p); - - MUL2 (a, da, a, da, x2, xx2, t1, t2); - - c1 = a25.d + x2 * a27.d; - c1 = a23.d + x2 * c1; - c1 = a21.d + x2 * c1; - c1 = a19.d + x2 * c1; - c1 = a17.d + x2 * c1; - c1 = a15.d + x2 * c1; - c1 *= x2; - - ADD2 (a13.d, aa13.d, c1, 0.0, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a11.d, aa11.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a9.d, aa9.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a7.d, aa7.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a5.d, aa5.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a3.d, aa3.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (x2, xx2, c2, cc2, c1, cc1, t1, t2); - MUL2 (a, da, c1, cc1, c2, cc2, t1, t2); - ADD2 (a, da, c2, cc2, c1, cc1, t1, t2); - - if (n) - { - /* Second stage -cot */ - DIV2 (1.0, 0.0, c1, cc1, c2, cc2, t1, t2, t3, t4); - if ((y = c2 + (cc2 - u24.d * c2)) == c2 + (cc2 + u24.d * c2)) - { - retval = (-y); - goto ret; - } + y = c + dc; + retval = (-y); + /* Max ULP is 0.506. */ + goto ret; } else { - /* Second stage tan */ - if ((y = c1 + (cc1 - u23.d * c1)) == c1 + (cc1 + u23.d * c1)) - { - retval = y; - goto ret; - } + /* tan */ + y = a + t2; + retval = y; + /* Max ULP is 0.507. */ + goto ret; } - retval = tanMp (x); - goto ret; } /* (XI) The case 1e8 < abs(x) < 2**1024, 0.0608 < abs(y) <= 0.787 */ - /* First stage */ - i = ((int) (mfftnhf.d + TWO8 * ya)); + i = ((int) (mfftnhf.d + 256 * ya)); z = (z0 = (ya - xfg[i][0].d)) + yya; z2 = z * z; pz = z + z * z2 * (e0.d + z2 * e1.d); @@ -739,97 +350,25 @@ __tan (double x) { /* -cot */ t2 = pz * (fi + gi) / (fi + pz); - if ((y = gi - (t2 - gi * u26.d)) == gi - (t2 + gi * u26.d)) - { - retval = (-sy * y); - goto ret; - } - t3 = (t2 < 0.0) ? -t2 : t2; - t4 = gi * ua26.d + t3 * ub26.d; - if ((y = gi - (t2 - t4)) == gi - (t2 + t4)) - { - retval = (-sy * y); - goto ret; - } + y = gi - t2; + retval = (-sy * y); + /* Max ULP is 0.62. */ + goto ret; } else { /* tan */ t2 = pz * (gi + fi) / (gi - pz); - if ((y = fi + (t2 - fi * u25.d)) == fi + (t2 + fi * u25.d)) - { - retval = (sy * y); - goto ret; - } - t3 = (t2 < 0.0) ? -t2 : t2; - t4 = fi * ua25.d + t3 * ub25.d; - if ((y = fi + (t2 - t4)) == fi + (t2 + t4)) - { - retval = (sy * y); - goto ret; - } - } - - /* Second stage */ - ffi = xfg[i][3].d; - EADD (z0, yya, z, zz); - MUL2 (z, zz, z, zz, z2, zz2, t1, t2); - c1 = z2 * (a7.d + z2 * (a9.d + z2 * a11.d)); - ADD2 (a5.d, aa5.d, c1, 0.0, c2, cc2, t1, t2); - MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2); - ADD2 (a3.d, aa3.d, c1, cc1, c2, cc2, t1, t2); - MUL2 (z2, zz2, c2, cc2, c1, cc1, t1, t2); - MUL2 (z, zz, c1, cc1, c2, cc2, t1, t2); - ADD2 (z, zz, c2, cc2, c1, cc1, t1, t2); - - ADD2 (fi, ffi, c1, cc1, c2, cc2, t1, t2); - MUL2 (fi, ffi, c1, cc1, c3, cc3, t1, t2); - SUB2 (1.0, 0.0, c3, cc3, c1, cc1, t1, t2); - - if (n) - { - /* -cot */ - DIV2 (c1, cc1, c2, cc2, c3, cc3, t1, t2, t3, t4); - if ((y = c3 + (cc3 - u28.d * c3)) == c3 + (cc3 + u28.d * c3)) - { - retval = (-sy * y); - goto ret; - } - } - else - { - /* tan */ - DIV2 (c2, cc2, c1, cc1, c3, cc3, t1, t2, t3, t4); - if ((y = c3 + (cc3 - u27.d * c3)) == c3 + (cc3 + u27.d * c3)) - { - retval = (sy * y); - goto ret; - } + y = fi + t2; + retval = (sy * y); + /* Max ULP is 0.62. */ + goto ret; } - retval = tanMp (x); - goto ret; ret: return retval; } -/* multiple precision stage */ -/* Convert x to multi precision number,compute tan(x) by mptan() routine */ -/* and converts result back to double */ -static double -SECTION -tanMp (double x) -{ - int p; - double y; - mp_no mpy; - p = 32; - __mptan (x, &mpy, p); - __mp_dbl (&mpy, &y, p); - LIBC_PROBE (slowtan, 2, &x, &y); - return y; -} - #ifndef __tan libm_alias_double (__tan, tan) #endif diff --git a/sysdeps/ieee754/dbl-64/utan.h b/sysdeps/ieee754/dbl-64/utan.h index ebe3e193a210280647f76564b6991f98bfe83a9b..8f1034eba855130258adb2aeb816c5722b3f9818 100644 --- a/sysdeps/ieee754/dbl-64/utan.h +++ b/sysdeps/ieee754/dbl-64/utan.h @@ -28,7 +28,7 @@ #define UTAN_H #ifdef BIG_ENDI - static const number + static const mynumber /* polynomial I */ /**/ d3 = {{0x3FD55555, 0x55555555} }, /* 0.333... */ /**/ d5 = {{0x3FC11111, 0x111107C6} }, /* 0.133... */ @@ -36,46 +36,6 @@ /**/ d9 = {{0x3F9664ED, 0x49CFC666} }, /* . */ /**/ d11 = {{0x3F82385A, 0x3CF2E4EA} }, /* . */ /* polynomial II */ -/**/ a3 = {{0x3fd55555, 0x55555555} }, /* 1/3 */ -/**/ aa3 = {{0x3c755555, 0x55555555} }, /* 1/3-a3 */ -/**/ a5 = {{0x3fc11111, 0x11111111} }, /* 2/15 */ -/**/ aa5 = {{0x3c411111, 0x11111111} }, /* 2/15-a5 */ -/**/ a7 = {{0x3faba1ba, 0x1ba1ba1c} }, /* 17/315 */ -/**/ aa7 = {{0xbc479179, 0x17917918} }, /* ()-a7 */ -/**/ a9 = {{0x3f9664f4, 0x882c10fa} }, /* 62/2835 */ -/**/ aa9 = {{0xbc09a528, 0x8b6c44fd} }, /* ()-a9 */ -/**/ a11 = {{0x3f8226e3, 0x55e6c23d} }, /* . */ -/**/ aa11 = {{0xbc2c292b, 0x8f1a2c13} }, /* . */ -/**/ a13 = {{0x3f6d6d3d, 0x0e157de0} }, /* . */ -/**/ aa13 = {{0xbc0280cf, 0xc968d971} }, /* . */ -/**/ a15 = {{0x3f57da36, 0x452b75e3} }, /* . */ -#if 0 -/**/ aa15 = {{0xbbf25789, 0xb285d2ed} }, /* . */ -#endif -/**/ a17 = {{0x3f435582, 0x48036744} }, /* . */ -#if 0 -/**/ aa17 = {{0x3be488d9, 0x563f1f23} }, /* . */ -#endif -/**/ a19 = {{0x3f2f57d7, 0x734d1664} }, /* . */ -#if 0 -/**/ aa19 = {{0x3bb0d55a, 0x913ccb50} }, /* . */ -#endif -/**/ a21 = {{0x3f1967e1, 0x8afcafad} }, /* . */ -#if 0 -/**/ aa21 = {{0xbbbd7614, 0xa42d44e6} }, /* . */ -#endif -/**/ a23 = {{0x3f0497d8, 0xeea25259} }, /* . */ -#if 0 -/**/ aa23 = {{0x3b99f2d0, 0x2e4d2863} }, /* . */ -#endif -/**/ a25 = {{0x3ef0b132, 0xd39a6050} }, /* . */ -#if 0 -/**/ aa25 = {{0x3b93b274, 0xc2c19614} }, /* . */ -#endif -/**/ a27 = {{0x3edb0f72, 0xd3ee24e9} }, /* . */ -#if 0 -/**/ aa27 = {{0x3b61688d, 0xdd595609} }, /* . */ -#endif /* polynomial III */ /**/ e0 = {{0x3FD55555, 0x55554DBD} }, /* . */ /**/ e1 = {{0x3FC11112, 0xE0A6B45F} }, /* . */ @@ -88,52 +48,8 @@ /**/ g3 = {{0x3fe92f1a, 0x00000000} }, /* 0.787 */ /**/ g4 = {{0x40390000, 0x00000000} }, /* 25.0 */ /**/ g5 = {{0x4197d784, 0x00000000} }, /* 1e8 */ -/**/ gy1 = {{0x3e7ad7f2, 0x9abcaf48} }, /* 1e-7 */ /**/ gy2 = {{0x3faf212d, 0x00000000} }, /* 0.0608 */ -/**/ u1 = {{0x3cc8c33a, 0x00000000} }, /* 6.873e-16 */ -/**/ u2 = {{0x3983dc4d, 0x00000000} }, /* 1.224e-31 */ -/**/ u3 = {{0x3c78e14b, 0x00000000} }, /* 2.158e-17 */ -/**/ ua3 = {{0x3bfd8b58, 0x00000000} }, /* 1.001e-19 */ -/**/ ub3 = {{0x3cc81898, 0x00000000} }, /* 6.688e-16 */ -/**/ u4 = {{0x399856c2, 0x00000000} }, /* 3e-31 */ -/**/ u5 = {{0x3c39d80a, 0x00000000} }, /* 1.401e-18 */ -/**/ u6 = {{0x3c374c5a, 0x00000000} }, /* 1.263e-18 */ -/**/ u7 = {{0x39903beb, 0x00000000} }, /* 2.001e-31 */ -/**/ u8 = {{0x399c56ae, 0x00000000} }, /* 3.493e-31 */ -/**/ u9 = {{0x3c7d0ac7, 0x00000000} }, /* 2.519e-17 */ -/**/ ua9 = {{0x3bfd8b58, 0x00000000} }, /* 1.001e-19 */ -/**/ ub9 = {{0x3ccc2375, 0x00000000} }, /* 7.810e-16 */ -/**/ u10 = {{0x3c7e40af, 0x00000000} }, /* 2.624e-17 */ -/**/ ua10 = {{0x3bfd8b58, 0x00000000} }, /* 1.001e-19 */ -/**/ ub10 = {{0x3ccc6405, 0x00000000} }, /* 7.880e-16 */ -/**/ u11 = {{0x39e509b6, 0x00000000} }, /* 8.298e-30 */ -/**/ u12 = {{0x39e509b6, 0x00000000} }, /* 8.298e-30 */ -/**/ u13 = {{0x3c39d80a, 0x00000000} }, /* 1.401e-18 */ -/**/ u14 = {{0x3c374c5a, 0x00000000} }, /* 1.263e-18 */ -/**/ u15 = {{0x3ab5767a, 0x00000000} }, /* 6.935e-26 */ -/**/ u16 = {{0x3ab57744, 0x00000000} }, /* 6.936e-26 */ -/**/ u17 = {{0x3c7d0ac7, 0x00000000} }, /* 2.519e-17 */ -/**/ ua17 = {{0x3bfdb11f, 0x00000000} }, /* 1.006e-19 */ -/**/ ub17 = {{0x3ccc2375, 0x00000000} }, /* 7.810e-16 */ -/**/ u18 = {{0x3c7e40af, 0x00000000} }, /* 2.624e-17 */ -/**/ ua18 = {{0x3bfdb11f, 0x00000000} }, /* 1.006e-19 */ -/**/ ub18 = {{0x3ccc6405, 0x00000000} }, /* 7.880e-16 */ -/**/ u19 = {{0x39a13b61, 0x00000000} }, /* 4.248e-31 */ -/**/ u20 = {{0x39a13b61, 0x00000000} }, /* 4.248e-31 */ -/**/ u21 = {{0x3c3bb9b8, 0x00000000} }, /* 1.503e-18 */ -/**/ u22 = {{0x3c392e08, 0x00000000} }, /* 1.365e-18 */ -/**/ u23 = {{0x3a0ce706, 0x00000000} }, /* 4.560e-29 */ -/**/ u24 = {{0x3a0cff5d, 0x00000000} }, /* 4.575e-29 */ -/**/ u25 = {{0x3c7d0ac7, 0x00000000} }, /* 2.519e-17 */ -/**/ ua25 = {{0x3bfd8b58, 0x00000000} }, /* 1.001e-19 */ -/**/ ub25 = {{0x3ccc2375, 0x00000000} }, /* 7.810e-16 */ -/**/ u26 = {{0x3c7e40af, 0x00000000} }, /* 2.624e-17 */ -/**/ ua26 = {{0x3bfd8b58, 0x00000000} }, /* 1.001e-19 */ -/**/ ub26 = {{0x3ccc6405, 0x00000000} }, /* 7.880e-16 */ -/**/ u27 = {{0x3ad421cb, 0x00000000} }, /* 2.602e-25 */ -/**/ u28 = {{0x3ad421cb, 0x00000000} }, /* 2.602e-25 */ - /**/ mp1 = {{0x3FF921FB, 0x58000000} }, /**/ mp2 = {{0xBE4DDE97, 0x3C000000} }, /**/ mp3 = {{0xBC8CB3B3, 0x99D747F2} }, @@ -145,7 +61,7 @@ #else #ifdef LITTLE_ENDI - static const number + static const mynumber /* polynomial I */ /**/ d3 = {{0x55555555, 0x3FD55555} }, /* 0.333... */ /**/ d5 = {{0x111107C6, 0x3FC11111} }, /* 0.133... */ @@ -153,46 +69,6 @@ /**/ d9 = {{0x49CFC666, 0x3F9664ED} }, /* . */ /**/ d11 = {{0x3CF2E4EA, 0x3F82385A} }, /* . */ /* polynomial II */ -/**/ a3 = {{0x55555555, 0x3fd55555} }, /* 1/3 */ -/**/ aa3 = {{0x55555555, 0x3c755555} }, /* 1/3-a3 */ -/**/ a5 = {{0x11111111, 0x3fc11111} }, /* 2/15 */ -/**/ aa5 = {{0x11111111, 0x3c411111} }, /* 2/15-a5 */ -/**/ a7 = {{0x1ba1ba1c, 0x3faba1ba} }, /* 17/315 */ -/**/ aa7 = {{0x17917918, 0xbc479179} }, /* ()-a7 */ -/**/ a9 = {{0x882c10fa, 0x3f9664f4} }, /* 62/2835 */ -/**/ aa9 = {{0x8b6c44fd, 0xbc09a528} }, /* ()-a9 */ -/**/ a11 = {{0x55e6c23d, 0x3f8226e3} }, /* . */ -/**/ aa11 = {{0x8f1a2c13, 0xbc2c292b} }, /* . */ -/**/ a13 = {{0x0e157de0, 0x3f6d6d3d} }, /* . */ -/**/ aa13 = {{0xc968d971, 0xbc0280cf} }, /* . */ -/**/ a15 = {{0x452b75e3, 0x3f57da36} }, /* . */ -#if 0 -/**/ aa15 = {{0xb285d2ed, 0xbbf25789} }, /* . */ -#endif -/**/ a17 = {{0x48036744, 0x3f435582} }, /* . */ -#if 0 -/**/ aa17 = {{0x563f1f23, 0x3be488d9} }, /* . */ -#endif -/**/ a19 = {{0x734d1664, 0x3f2f57d7} }, /* . */ -#if 0 -/**/ aa19 = {{0x913ccb50, 0x3bb0d55a} }, /* . */ -#endif -/**/ a21 = {{0x8afcafad, 0x3f1967e1} }, /* . */ -#if 0 -/**/ aa21 = {{0xa42d44e6, 0xbbbd7614} }, /* . */ -#endif -/**/ a23 = {{0xeea25259, 0x3f0497d8} }, /* . */ -#if 0 -/**/ aa23 = {{0x2e4d2863, 0x3b99f2d0} }, /* . */ -#endif -/**/ a25 = {{0xd39a6050, 0x3ef0b132} }, /* . */ -#if 0 -/**/ aa25 = {{0xc2c19614, 0x3b93b274} }, /* . */ -#endif -/**/ a27 = {{0xd3ee24e9, 0x3edb0f72} }, /* . */ -#if 0 -/**/ aa27 = {{0xdd595609, 0x3b61688d} }, /* . */ -#endif /* polynomial III */ /**/ e0 = {{0x55554DBD, 0x3FD55555} }, /* . */ /**/ e1 = {{0xE0A6B45F, 0x3FC11112} }, /* . */ @@ -205,52 +81,8 @@ /**/ g3 = {{0x00000000, 0x3fe92f1a} }, /* 0.787 */ /**/ g4 = {{0x00000000, 0x40390000} }, /* 25.0 */ /**/ g5 = {{0x00000000, 0x4197d784} }, /* 1e8 */ -/**/ gy1 = {{0x9abcaf48, 0x3e7ad7f2} }, /* 1e-7 */ /**/ gy2 = {{0x00000000, 0x3faf212d} }, /* 0.0608 */ -/**/ u1 = {{0x00000000, 0x3cc8c33a} }, /* 6.873e-16 */ -/**/ u2 = {{0x00000000, 0x3983dc4d} }, /* 1.224e-31 */ -/**/ u3 = {{0x00000000, 0x3c78e14b} }, /* 2.158e-17 */ -/**/ ua3 = {{0x00000000, 0x3bfd8b58} }, /* 1.001e-19 */ -/**/ ub3 = {{0x00000000, 0x3cc81898} }, /* 6.688e-16 */ -/**/ u4 = {{0x00000000, 0x399856c2} }, /* 3e-31 */ -/**/ u5 = {{0x00000000, 0x3c39d80a} }, /* 1.401e-18 */ -/**/ u6 = {{0x00000000, 0x3c374c5a} }, /* 1.263e-18 */ -/**/ u7 = {{0x00000000, 0x39903beb} }, /* 2.001e-31 */ -/**/ u8 = {{0x00000000, 0x399c56ae} }, /* 3.493e-31 */ -/**/ u9 = {{0x00000000, 0x3c7d0ac7} }, /* 2.519e-17 */ -/**/ ua9 = {{0x00000000, 0x3bfd8b58} }, /* 1.001e-19 */ -/**/ ub9 = {{0x00000000, 0x3ccc2375} }, /* 7.810e-16 */ -/**/ u10 = {{0x00000000, 0x3c7e40af} }, /* 2.624e-17 */ -/**/ ua10 = {{0x00000000, 0x3bfd8b58} }, /* 1.001e-19 */ -/**/ ub10 = {{0x00000000, 0x3ccc6405} }, /* 7.880e-16 */ -/**/ u11 = {{0x00000000, 0x39e509b6} }, /* 8.298e-30 */ -/**/ u12 = {{0x00000000, 0x39e509b6} }, /* 8.298e-30 */ -/**/ u13 = {{0x00000000, 0x3c39d80a} }, /* 1.401e-18 */ -/**/ u14 = {{0x00000000, 0x3c374c5a} }, /* 1.263e-18 */ -/**/ u15 = {{0x00000000, 0x3ab5767a} }, /* 6.935e-26 */ -/**/ u16 = {{0x00000000, 0x3ab57744} }, /* 6.936e-26 */ -/**/ u17 = {{0x00000000, 0x3c7d0ac7} }, /* 2.519e-17 */ -/**/ ua17 = {{0x00000000, 0x3bfdb11f} }, /* 1.006e-19 */ -/**/ ub17 = {{0x00000000, 0x3ccc2375} }, /* 7.810e-16 */ -/**/ u18 = {{0x00000000, 0x3c7e40af} }, /* 2.624e-17 */ -/**/ ua18 = {{0x00000000, 0x3bfdb11f} }, /* 1.006e-19 */ -/**/ ub18 = {{0x00000000, 0x3ccc6405} }, /* 7.880e-16 */ -/**/ u19 = {{0x00000000, 0x39a13b61} }, /* 4.248e-31 */ -/**/ u20 = {{0x00000000, 0x39a13b61} }, /* 4.248e-31 */ -/**/ u21 = {{0x00000000, 0x3c3bb9b8} }, /* 1.503e-18 */ -/**/ u22 = {{0x00000000, 0x3c392e08} }, /* 1.365e-18 */ -/**/ u23 = {{0x00000000, 0x3a0ce706} }, /* 4.560e-29 */ -/**/ u24 = {{0x00000000, 0x3a0cff5d} }, /* 4.575e-29 */ -/**/ u25 = {{0x00000000, 0x3c7d0ac7} }, /* 2.519e-17 */ -/**/ ua25 = {{0x00000000, 0x3bfd8b58} }, /* 1.001e-19 */ -/**/ ub25 = {{0x00000000, 0x3ccc2375} }, /* 7.810e-16 */ -/**/ u26 = {{0x00000000, 0x3c7e40af} }, /* 2.624e-17 */ -/**/ ua26 = {{0x00000000, 0x3bfd8b58} }, /* 1.001e-19 */ -/**/ ub26 = {{0x00000000, 0x3ccc6405} }, /* 7.880e-16 */ -/**/ u27 = {{0x00000000, 0x3ad421cb} }, /* 2.602e-25 */ -/**/ u28 = {{0x00000000, 0x3ad421cb} }, /* 2.602e-25 */ - /**/ mp1 = {{0x58000000, 0x3FF921FB} }, /**/ mp2 = {{0x3C000000, 0xBE4DDE97} }, /**/ mp3 = {{0x99D747F2, 0xBC8CB3B3} }, diff --git a/sysdeps/ieee754/dbl-64/utan.tbl b/sysdeps/ieee754/dbl-64/utan.tbl index b094d164b8189c26145083a5dbe86454c10ec754..80796293de54d676fefdfa23e302bce254b8f7bc 100644 --- a/sysdeps/ieee754/dbl-64/utan.tbl +++ b/sysdeps/ieee754/dbl-64/utan.tbl @@ -23,7 +23,7 @@ #ifdef BIG_ENDI -static const number +static const mynumber xfg[186][4] = { /* xi,Fi,Gi,FFi, i=16..201 */ /**/ {{{0x3fb00000, 0x1e519d60} }, /**/ {{0x3fb00557, 0x96c4e240} }, @@ -773,7 +773,7 @@ static const number #else #ifdef LITTLE_ENDI -static const number +static const mynumber xfg[186][4] = { /* xi,Fi,Gi,FFi, i=16..201 */ /**/ {{{0x1e519d60, 0x3fb00000} }, /**/ {{0x96c4e240, 0x3fb00557} }, From patchwork Mon Jan 4 12:19:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 41621 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D606038708D5; Mon, 4 Jan 2021 12:19:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D606038708D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609762789; bh=cLQSPh1TUGTH/KuGMN+zBm2+vX+3pyvXvNLwoEsEPhI=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WFMR9D/NVe+xj1ymo+YDDRsqnP91gr7NKwkL4v6MU8qztlbyA4GH2mjR4LRRaE5KK 0nMzwZeDxVLavg7pKnQP/VZ7sx0JRokd/F+fXqoGhRSFDA5BtVqWCkwSu4bX3okGBb 43UitTSDxX73EgwFoE5MES7GERtXRAyipZTIKvws= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70044.outbound.protection.outlook.com [40.107.7.44]) by sourceware.org (Postfix) with ESMTPS id 9C22538708A6 for ; Mon, 4 Jan 2021 12:19:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9C22538708A6 Received: from DB6PR0501CA0021.eurprd05.prod.outlook.com (2603:10a6:4:8f::31) by AM0PR08MB5314.eurprd08.prod.outlook.com (2603:10a6:208:184::7) 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:19:43 +0000 Received: from DB5EUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:8f:cafe::e3) by DB6PR0501CA0021.outlook.office365.com (2603:10a6:4:8f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20 via Frontend Transport; Mon, 4 Jan 2021 12:19:43 +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 DB5EUR03FT045.mail.protection.outlook.com (10.152.21.164) 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:19:43 +0000 Received: ("Tessian outbound 8b6e0bb22f1c:v71"); Mon, 04 Jan 2021 12:19:43 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 955584022648f6f4 X-CR-MTA-TID: 64aa7808 Received: from 3beafa7ca0d9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 52A6D8A7-04CE-416F-9686-41A89A0903EA.1; Mon, 04 Jan 2021 12:19:38 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3beafa7ca0d9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 04 Jan 2021 12:19:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDsZUIwgT6R4LdApZ+niNjqXJvBbyjQszAeCYhyAyLWabzFoSvTdYyFyNLjZyjdN2lAfNUAa9vcm53KF58F60PvNtguHo86Bmep/ynpGTQZrKCMlAe3LRv4a57A8r4/2Y8JR0KT4cV9CYSe8tA2E9STRrzn8/XZVggqvJM5O5vhDCve/tF/cA5bRthEEHiL1uQ9VWaC+vvqou5eUiDb+Nbr6w3pS4qGX+Uq7dmc7yksjAhIWKvIMIWxTxr0NSNudQ5NqoGcVy2M6ZydQ35W+4ItPer0pBB/vjbZ52QJql2SG191i8uze9ytbJOOhLB/5NgZ9rdYFiVf5X7wKLpA4ZA== 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=cLQSPh1TUGTH/KuGMN+zBm2+vX+3pyvXvNLwoEsEPhI=; b=l9LHrySSWvyErI57dr1ICLOd4o/rc3D7Vw0cot0BaYBtJUv1UFegJ/HtOMGg5TcnU9Edmg4o0oMHFysPefMV8zkB16ZlYpzmbXKAJLYAvtwF/iFIEOoX4DlUsggjSfFNN1XZ/AkWrVQj+nRkCPVlkrk4ydn4434nFdtznKxBs970dqzRQ1xnwxXB5tLfNO5MOpDzBYcFlZyic45jje064w8OaPFnHCyo0sdVvYHKd1DJ/F6P/MFUqdUm+NEa9CvUxkNmfrNl2TzG89E75Ybf+JBPe2uBFoy0K6B6Luv90XK92lpnepxLvsFjUwxPP0WNEU2P8WHmsxgoU+ok0tPilA== 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:19:35 +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:19:35 +0000 To: 'GNU C Library' Subject: [PATCH 3/5] Remove slow paths from atan Thread-Topic: [PATCH 3/5] Remove slow paths from atan Thread-Index: AQHW4pPd+I105q7+9Uu2w+Y9xRNMUw== Date: Mon, 4 Jan 2021 12:19:35 +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: 4eabae04-5fc3-4db4-d283-08d8b0ab0482 x-ms-traffictypediagnostic: VE1PR08MB4718:|AM0PR08MB5314: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:156;OLM:156; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 7C30wxVlWZJAHb9g02fKg0IbzMz31P2X4x+bQdm0xvg2JXOqZmqyIyhZaTLEQKoUGfOVHeUxTsxt6LPF921EIkMT2Y6+XSgmtqkG0GYOL2az39Okg560D/xcKUdI/OXLF9TiW7gM+W5s6ltV3OZu5L08smPL8c01RCrQpsE3lS4UEnF95gLJq7l+jv+f0QnEGMKyOjtw7geQCQQX9yBzHaM7zmTmm+J9K8QFKLDYQg3z1qvP0Qrbfh64XNRfnJQlqPScppUQAyy1cVnYUnC7xUm1X0ecOOf9Mb8DBiKerkpO/MIYy8HHfSAhGrRzOwml5mdkbY9FjNwe2zI5pc4sEcpNvz0lmfPeplKWCXDb6CUaSKXRFLKgh5moMbB+L0u+Nq5LhcQAranqUe9RU+I9CQ== 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)(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?yp6DiMqmdlf5pa6n2IMAvmI6G?= =?iso-8859-1?q?ULYMwNBfDDBj2qhYtq+51o5IDCaK8I0/LbmCZ5g/VBE5HDdv8Y6XTmNz2r/e?= =?iso-8859-1?q?Zqtpcl7vRgvCWANqZWGaIQXTrPomCIdd89AmJqHeypsCxAGLJXQXK04MCjzW?= =?iso-8859-1?q?cfRVpA4b31XY8KFMiwEXzqFv+iNbHN8UoRmd43dn04mECQUT6UY2bVIzxhMJ?= =?iso-8859-1?q?N2li+ExiGnXOgCpKkEfbM+fAO1FCv9xdQtvPShhWOvaEywGtd0yh1ZukfuUG?= =?iso-8859-1?q?7kfKn0pW9mt2fwkl1tY0INaF8vo1cDB0wP7iNd6lApZabqGITvW4aZH2vvsL?= =?iso-8859-1?q?hxqWQ55+zIW+s/FK6jF2Sfy/atPEp8uPj0gUDzHT0l7cAxospoG8pRElayf6?= =?iso-8859-1?q?5CtfVyCC06KwzXM0OcICNeRtK0/qeYd0WSz9D8vxmMu2LmAEVLvmRpvUB2wG?= =?iso-8859-1?q?jmpJSqSn0kunSY49JA8PiF1gLOmuJtSkQUVvOznZwYGA/38+QunYZ7g3OKqd?= =?iso-8859-1?q?+nfHcVaDwUVeENjERaBVhHJm9lQbhzbyPNwH1Ja5+4HGp6xGsYJnx2dtQfjK?= =?iso-8859-1?q?G7m/mknpIiVKAqgJkDAgYkh6ntrUT3HwRkoTX8PtdmaYHM1rhQcMl2hbhMco?= =?iso-8859-1?q?YiAIq4k06PQhTwkcnjSaxJ9zKb3dVpOzIz4U4k6QXPwnne1NvGQ+IJDn1nr6?= =?iso-8859-1?q?E7f0QfVGxXI8JuQ8uP1La45ZL/+CxpxiO1JvBb34RTOkVWpVUobKMoBZcnA+?= =?iso-8859-1?q?T8llyw8vbOy6ka1Jy7lOHWEq0fXGSVqys7jSR+DHDMEdtsbqzNnvK7Bitmz9?= =?iso-8859-1?q?i+Pf/1rlFxe13/YWj3wUvjtLUoj930mI02RAiFat1nB9Us/3y6aWIcvh4zm5?= =?iso-8859-1?q?c+g4rnOrQ9myAXKASjjl//WHlKfapeslX3iV5ySf59AyrNnJ+aJqRiPVL4Kp?= =?iso-8859-1?q?J6bs/cEXXaoP3Fl1K5EmZYK/tXFH3rBHjw0ownWlbhwVaaj0xESMTKdI1cbB?= =?iso-8859-1?q?5c4RQG4k3wF4DmutFo=3D?= x-ms-exchange-transport-forked: True 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: DB5EUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 8bdaa13d-b6f6-4eda-619d-08d8b0aafffe X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v+8ARNosZhPTuNYUqEH/Pumeje8nDwKeF1uJthAte8KFAtmhjKvtZmL+oywPQIhXJOv8FAZQwfEbmVttF775RU9PxWlK7Qa4yS9YsdSq/QOyBkhQir0WA2hr9gFclN/+2KbLCBg4cb3oY01jimWLoS3FnhF/uQcDHzpti5w5b1DvWt+xSth70DRKNI1AtJ7UmClEBB7x/3fYlP7zP5LlcbqO9jlhfTnKH+LLWZZshhs5lH6Eic5LjHfgVGK7wooOs7KIQHVQd/jgjEqP1nrof4VKLNNi2SbfmQqpuDQsqqab1bWcOStz+rC3PM6QAray+2tFuq/d7DyqWzm3DcNo+e+2oJRCLYL4mQOr/N3Ieu+d4/P6YTQQmAlyevphF/1PGoBmt7loiJhKNP7oGXddgtNf87GTR8xMcNLftgy5bn1lJbdPPCWtAhgQo7aY4IUSEnWy5lLnW8mpkJaLSbrZvw== 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)(136003)(346002)(376002)(396003)(46966006)(8676002)(52536014)(8936002)(6506007)(33656002)(336012)(5660300002)(82310400003)(26005)(478600001)(6916009)(186003)(47076005)(82740400003)(7696005)(2906002)(316002)(70206006)(70586007)(9686003)(86362001)(55016002)(356005)(2940100002)(81166007)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2021 12:19:43.4433 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4eabae04-5fc3-4db4-d283-08d8b0ab0482 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: DB5EUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5314 X-Spam-Status: No, score=-12.5 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-Patchwork-Original-From: Wilco Dijkstra via Libc-alpha From: Wilco Dijkstra Reply-To: Wilco Dijkstra Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Remove slow paths from atan. Add ULP annotations. Passes GLIBC testsuite. diff --git a/sysdeps/ieee754/dbl-64/atnat.h b/sysdeps/ieee754/dbl-64/atnat.h index bb4a2ebdc4bd9b2f2ec8ec4395b91c683eb83a8f..29d7671b86750edb810e3918d3076bab23c0f56a 100644 --- a/sysdeps/ieee754/dbl-64/atnat.h +++ b/sysdeps/ieee754/dbl-64/atnat.h @@ -29,7 +29,7 @@ #define M 4 #ifdef BIG_ENDI - static const number + static const mynumber /* polynomial I */ /**/ d3 = {{0xbfd55555, 0x55555555} }, /* -0.333... */ /**/ d5 = {{0x3fc99999, 0x999997fd} }, /* 0.199... */ @@ -79,7 +79,7 @@ #else #ifdef LITTLE_ENDI - static const number + static const mynumber /* polynomial I */ /**/ d3 = {{0x55555555, 0xbfd55555} }, /* -0.333... */ /**/ d5 = {{0x999997fd, 0x3fc99999} }, /* 0.199... */ diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_atan.c index 30b0906826d005c17f9322ff7172ec06b66dc03e..fdd18920b38dda61d2ed43abfdadb0057d6d611f 100644 --- a/sysdeps/ieee754/dbl-64/s_atan.c +++ b/sysdeps/ieee754/dbl-64/s_atan.c @@ -20,25 +20,15 @@ /* MODULE_NAME: atnat.c */ /* */ /* FUNCTIONS: uatan */ -/* atanMp */ /* signArctan */ /* */ -/* */ -/* FILES NEEDED: dla.h endian.h mpa.h mydefs.h atnat.h */ -/* mpatan.c mpatan2.c mpsqrt.c */ +/* FILES NEEDED: dla.h endian.h mydefs.h atnat.h */ /* uatan.tbl */ /* */ -/* An ultimate atan() routine. Given an IEEE double machine number x */ -/* it computes the correctly rounded (to nearest) value of atan(x). */ -/* */ -/* Assumption: Machine arithmetic operations are performed in */ -/* round to nearest mode of IEEE 754 standard. */ -/* */ /************************************************************************/ #include -#include "mpa.h" -#include "MathLib.h" +#include "mydefs.h" #include "uatan.tbl" #include "atnat.h" #include @@ -47,10 +37,8 @@ #include #include #include -#include -void __mpatan (mp_no *, mp_no *, int); /* see definition in mpatan.c */ -static double atanMp (double, const int[]); +#define TWO52 0x1.0p52 /* Fix the sign of y and return */ static double @@ -60,16 +48,13 @@ __signArctan (double x, double y) } -/* An ultimate atan() routine. Given an IEEE double machine number x, */ -/* routine computes the correctly rounded (to nearest) value of atan(x). */ double __atan (double x) { - double cor, s1, ss1, s2, ss2, t1, t2, t3, t4, u, u2, u3, - v, vv, w, ww, y, yy, z, zz; + double cor, t1, t2, t3, u, + v, w, ww, y, yy, z; int i, ux, dx; - static const int pr[M] = { 6, 8, 10, 32 }; - number num; + mynumber num; num.d = x; ux = num.i[HIGH_HALF]; @@ -102,36 +87,14 @@ __atan (double x) yy = d3.d + v * yy; yy *= x * v; - if ((y = x + (yy - U1 * x)) == x + (yy + U1 * x)) - return y; - - EMULV (x, x, v, vv); /* v+vv=x^2 */ - - s1 = f17.d + v * f19.d; - s1 = f15.d + v * s1; - s1 = f13.d + v * s1; - s1 = f11.d + v * s1; - s1 *= v; - - ADD2 (f9.d, ff9.d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f7.d, ff7.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f5.d, ff5.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f3.d, ff3.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - MUL2 (x, 0, s1, ss1, s2, ss2, t1, t2); - ADD2 (x, 0, s2, ss2, s1, ss1, t1, t2); - if ((y = s1 + (ss1 - U5 * s1)) == s1 + (ss1 + U5 * s1)) - return y; - - return atanMp (x, pr); + y = x + yy; + /* Max ULP is 0.511. */ + return y; } } else { /* B <= u < C */ - i = (TWO52 + TWO8 * u) - TWO52; + i = (TWO52 + 256 * u) - TWO52; i -= 16; z = u - cij[i][0].d; yy = cij[i][5].d + z * cij[i][6].d; @@ -141,44 +104,9 @@ __atan (double x) yy *= z; t1 = cij[i][1].d; - if (i < 112) - { - if (i < 48) - u2 = U21; /* u < 1/4 */ - else - u2 = U22; - } /* 1/4 <= u < 1/2 */ - else - { - if (i < 176) - u2 = U23; /* 1/2 <= u < 3/4 */ - else - u2 = U24; - } /* 3/4 <= u <= 1 */ - if ((y = t1 + (yy - u2 * t1)) == t1 + (yy + u2 * t1)) - return __signArctan (x, y); - - z = u - hij[i][0].d; - - s1 = hij[i][14].d + z * hij[i][15].d; - s1 = hij[i][13].d + z * s1; - s1 = hij[i][12].d + z * s1; - s1 = hij[i][11].d + z * s1; - s1 *= z; - - ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2); - MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][5].d, hij[i][6].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][3].d, hij[i][4].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (z, 0, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2); - if ((y = s2 + (ss2 - U6 * s2)) == s2 + (ss2 + U6 * s2)) - return __signArctan (x, y); - - return atanMp (x, pr); + y = t1 + yy; + /* Max ULP is 0.56. */ + return __signArctan (x, y); } } else @@ -188,7 +116,7 @@ __atan (double x) w = 1 / u; EMULV (w, u, t1, t2); ww = w * ((1 - t1) - t2); - i = (TWO52 + TWO8 * w) - TWO52; + i = (TWO52 + 256 * w) - TWO52; i -= 16; z = (w - cij[i][0].d) + ww; @@ -199,37 +127,9 @@ __atan (double x) yy = HPI1 - z * yy; t1 = HPI - cij[i][1].d; - if (i < 112) - u3 = U31; /* w < 1/2 */ - else - u3 = U32; /* w >= 1/2 */ - if ((y = t1 + (yy - u3)) == t1 + (yy + u3)) - return __signArctan (x, y); - - DIV2 (1, 0, u, 0, w, ww, t1, t2, t3, t4); - t1 = w - hij[i][0].d; - EADD (t1, ww, z, zz); - - s1 = hij[i][14].d + z * hij[i][15].d; - s1 = hij[i][13].d + z * s1; - s1 = hij[i][12].d + z * s1; - s1 = hij[i][11].d + z * s1; - s1 *= z; - - ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2); - MUL2 (z, zz, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (z, zz, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][5].d, hij[i][6].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (z, zz, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][3].d, hij[i][4].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (z, zz, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2); - SUB2 (HPI, HPI1, s2, ss2, s1, ss1, t1, t2); - if ((y = s1 + (ss1 - U7)) == s1 + (ss1 + U7)) - return __signArctan (x, y); - - return atanMp (x, pr); + y = t1 + yy; + /* Max ULP is 0.503. */ + return __signArctan (x, y); } else { @@ -249,34 +149,9 @@ __atan (double x) ww = w * ((1 - t1) - t2); ESUB (HPI, w, t3, cor); yy = ((HPI1 + cor) - ww) - yy; - if ((y = t3 + (yy - U4)) == t3 + (yy + U4)) - return __signArctan (x, y); - - DIV2 (1, 0, u, 0, w, ww, t1, t2, t3, t4); - MUL2 (w, ww, w, ww, v, vv, t1, t2); - - s1 = f17.d + v * f19.d; - s1 = f15.d + v * s1; - s1 = f13.d + v * s1; - s1 = f11.d + v * s1; - s1 *= v; - - ADD2 (f9.d, ff9.d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f7.d, ff7.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f5.d, ff5.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f3.d, ff3.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - MUL2 (w, ww, s1, ss1, s2, ss2, t1, t2); - ADD2 (w, ww, s2, ss2, s1, ss1, t1, t2); - SUB2 (HPI, HPI1, s1, ss1, s2, ss2, t1, t2); - - if ((y = s2 + (ss2 - U8)) == s2 + (ss2 + U8)) - return __signArctan (x, y); - - return atanMp (x, pr); + y = t3 + yy; + /* Max ULP is 0.5003. */ + return __signArctan (x, y); } else { @@ -290,35 +165,6 @@ __atan (double x) } } - /* Final stages. Compute atan(x) by multiple precision arithmetic */ -static double -atanMp (double x, const int pr[]) -{ - mp_no mpx, mpy, mpy2, mperr, mpt1, mpy1; - double y1, y2; - int i, p; - - for (i = 0; i < M; i++) - { - p = pr[i]; - __dbl_mp (x, &mpx, p); - __mpatan (&mpx, &mpy, p); - __dbl_mp (u9[i].d, &mpt1, p); - __mul (&mpy, &mpt1, &mperr, p); - __add (&mpy, &mperr, &mpy1, p); - __sub (&mpy, &mperr, &mpy2, p); - __mp_dbl (&mpy1, &y1, p); - __mp_dbl (&mpy2, &y2, p); - if (y1 == y2) - { - LIBC_PROBE (slowatan, 3, &p, &x, &y1); - return y1; - } - } - LIBC_PROBE (slowatan_inexact, 3, &p, &x, &y1); - return y1; /*if impossible to do exact computing */ -} - #ifndef __atan libm_alias_double (__atan, atan) #endif diff --git a/sysdeps/ieee754/dbl-64/uatan.tbl b/sysdeps/ieee754/dbl-64/uatan.tbl index 9730d576d6562e7a56d6f6f59e9943ec9e8a5343..3db2804cc2833ba94ebf428ea881c4ab5e833e4c 100644 --- a/sysdeps/ieee754/dbl-64/uatan.tbl +++ b/sysdeps/ieee754/dbl-64/uatan.tbl @@ -25,7 +25,7 @@ #ifdef BIG_ENDI - static const number + static const mynumber cij[241][7] = { /* x0,cij for (1/16,1) */ /**/ {{{0X3FB04006, 0X65E0244E} }, /**/ {{0X3FB03A73, 0X7B53DD20} }, @@ -1716,7 +1716,7 @@ /**/ {{0XBF99B9A7, 0X18A3BA58} } }, }; - static const number + static const mynumber hij[241][16] = { /* x0,hij for (1/16,1) */ /**/ {{{0x3fb04000, 0x00000000} }, /**/ {{0x3fb03a6d, 0x1c06693d} }, @@ -5579,7 +5579,7 @@ #else #ifdef LITTLE_ENDI - static const number + static const mynumber cij[241][7] = { /* x0,cij for (1/16,1) */ /**/ {{{0X65E0244E, 0X3FB04006} }, /**/ {{0X7B53DD20, 0X3FB03A73} }, @@ -7270,7 +7270,7 @@ /**/ {{0X18A3BA58, 0XBF99B9A7} } }, }; - static const number + static const mynumber hij[241][16] = { /* x0,hij for (1/16,1) */ /**/ {{{0x00000000, 0x3fb04000} }, /**/ {{0x1c06693d, 0x3fb03a6d} }, From patchwork Mon Jan 4 12:21:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 41622 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 258E138708AA; Mon, 4 Jan 2021 12:22:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 258E138708AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609762928; bh=NuXZDbVeNLsA/iZYlDKQ9QAamQSC8oyxWdw4ZPKmkuc=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=sgZgT7bpKr7zDPkJPAETQMPQ1X8XmxYlkV4f2w1vFzywUXNwJJpatnpA05c9j0ObM szvPeL59kTQ7XTGcOsrcOD5bZ/jVh5yOy4hTzGn5EO/vbGW5rsL9NqR7jD+FmuooP9 uCtpVkcBoE35tWMfSmPgmr+qiozcWAHzhixc6WVM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2079.outbound.protection.outlook.com [40.107.21.79]) by sourceware.org (Postfix) with ESMTPS id F16D53857C6F for ; Mon, 4 Jan 2021 12:22:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F16D53857C6F Received: from AM6PR02CA0006.eurprd02.prod.outlook.com (2603:10a6:20b:6e::19) by HE1PR08MB2827.eurprd08.prod.outlook.com (2603:10a6:7:37::11) 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:22:01 +0000 Received: from AM5EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:6e:cafe::8b) by AM6PR02CA0006.outlook.office365.com (2603:10a6:20b:6e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.19 via Frontend Transport; Mon, 4 Jan 2021 12:22:00 +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 AM5EUR03FT044.mail.protection.outlook.com (10.152.17.56) 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:22:00 +0000 Received: ("Tessian outbound 6ec21dac9dd3:v71"); Mon, 04 Jan 2021 12:22:00 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: af565c74dbae7ffe X-CR-MTA-TID: 64aa7808 Received: from 1d7effa6c85b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 462EA606-615D-4355-BBEB-B56E5D6385EB.1; Mon, 04 Jan 2021 12:21:55 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1d7effa6c85b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 04 Jan 2021 12:21:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cFThXWPiSasN9BXqSixEHUtEMiziORpxj2aovUzd4/oBe0+P7jP9qYLG38pysEO2RCt9Pfxe05T0xICoJ2TIC0wTYOlrrim3KCHl39XABzal4b0A31k2oSjJL3tu+Z+XB75PyOC1VdJOfePItWhfX5PlLxcr1i9ko6O3JQ2CBKSOQtjKa5h+ruqUGbUldaaM+Aj7yfOAOJRmad6nEnPeX5fjOrxqlGNPt8hjbcMc1QpLEIjnvPy8+EeHHC0jPFlwyg9JM+JlnN7i3+wYnlM3C5SrgSWtlnR5NqTzZ/Fe7KTw0uOi5SdSkJgimqoIhg/ZX67qVTd2KcKLu80nULv4Lg== 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=NuXZDbVeNLsA/iZYlDKQ9QAamQSC8oyxWdw4ZPKmkuc=; b=VFBCAdd3MiFkMwGuL3OvUp+bBiCJXy8h2XCOGZQXfDtvL2lU+KRjYMkVkH51yBQcicoPr+1izQt9w74o+kTrjJbF/1fRRTdeHDPeAs8D7NtSYM/+ZWUCH/KOqB8z1tIuW4QNGoRMXE6uopFon//PWoF8w9cD7IwqVSlwQhWSnAoHQq0ZM/T9kol2TJjEPtOWdHKglVdsCxYiQscoihe9FKL1u/n1nzV0dK7xiNK6sjH1cL6Q0Nay0bNZWMOuEyfF4oTvmeCpku8eXpQ/u6+F+/AngOnmfUXuDiV+nRe13+pU4sapkakLpCuVuh7GWHM910RStmpPvXfKBg5HBNyVPw== 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 VI1PR08MB5342.eurprd08.prod.outlook.com (2603:10a6:803:132::14) 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:21:53 +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:21:53 +0000 To: 'GNU C Library' Subject: [PATCH 4/5] Remove slow paths from atan2 Thread-Topic: [PATCH 4/5] Remove slow paths from atan2 Thread-Index: AQHW4pQvR2Oi5HS+2kC9PyGOHJ3UuQ== Date: Mon, 4 Jan 2021 12:21:53 +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: dedb56ae-8762-48f2-7e12-08d8b0ab566a x-ms-traffictypediagnostic: VI1PR08MB5342:|HE1PR08MB2827: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:352;OLM:352; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: CI7aAVI38z2aq9fM2YNG6C2I83It62NufKmYL4DLP6WXhlQ1UXjKq3a76jE0u12NmUOm+IiZZyXGAmsjK/3Wkhw690YprZcJsmRgFWVWt/qrdCvnMv24hjMGs9BxSazwYj40yf1QVaBs5YxWd0RUfiWn0SWJkDUi8M9SctuwgtLZDgNDqbBdFze4drb4ykQbjH0in+eY82QoCyZvWvfC7FuFBwiX2nEnksAhgcYb1LcLdcABkH7nwPWz17cl0I1CCequbmAvR5TA905ORKCqTtkTEmKubBe4Y9Lw7rgcJvn8EoTNPNQRVeXZeJaBqngGpZKUPzawu0r/V+yZQKj+h7Ukj/3x92zbe4JOglRjrt9kgLt7JcsXTwfLqLcRUaXP3Z9D+Oz15/LsgZ0R5alPAA== 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)(396003)(376002)(346002)(366004)(39860400002)(66446008)(2906002)(5660300002)(52536014)(7696005)(86362001)(30864003)(6506007)(91956017)(76116006)(33656002)(64756008)(83380400001)(66946007)(8936002)(316002)(66556008)(66476007)(71200400001)(26005)(2940100002)(8676002)(186003)(478600001)(55016002)(6916009)(9686003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?q?rGaQpFxgiaByHl9v4dPP4O2gj?= =?iso-8859-1?q?dY9kKUEFaZn26TsU40IO9sEUgpplyyuhkty3lI1xnWK23cDGhENc+uIbeHnE?= =?iso-8859-1?q?Srz5FyNPHhyqMcZlmGys7t/cjiYjwrSBtX/T8FFNubUawMCzyrIwCgKOlXH8?= =?iso-8859-1?q?Zcic+G5bOEyUmHy3I3BhWTnAG3TecY8ZiakFQHRJgm6n5QOf6u+MbVbbriv6?= =?iso-8859-1?q?gsbNZdgDGlZYev2sob459i+WCSjgESmWZYSOb2sClq5gYRB7sjwXxPsgXYm8?= =?iso-8859-1?q?6eo28NmPoBLjmJrlrkOUep6EG2zdyuf6aU4EvuI+Lz0vaL/b8ccR0nyAUIe5?= =?iso-8859-1?q?NwuZUYbPr3a1Az4A5I/p4fbZF1n4XEQbLsTkfexuLVHjpEXI4nvKDA+L2JU9?= =?iso-8859-1?q?aAPHdC8icsY8hBVFYjDXn18p0V2eVjrYRxmNDaHhqTRJQpE09AONApcad4wC?= =?iso-8859-1?q?usDUeSMjIDSVwzIKO5lS552JN+jJKKvQFI/P88Jy8rqgU2Eg1OW8jd8hoDv9?= =?iso-8859-1?q?wuR2LaDWY+XQc5TtdebGJaLTyeWi2lVyA15q1vAKpTHiz1J01TAKtPQSp8aI?= =?iso-8859-1?q?+41iqTPesnp3Zz71TRCLzQfHCBzwb5qKjz1NpH7K50Dg9O8mwc+PsZNEI3Xz?= =?iso-8859-1?q?LUpfJAT1Om8XTnqujxvrzK+13T9XV+6UdeoipSLy0+Su5fvLDugjif0WrXEi?= =?iso-8859-1?q?0GIIyXU8QywySc0Jvwyy0BE+rYkCIpSYfXMvf6HRMVKoHVKpz5us9zJrw8wY?= =?iso-8859-1?q?01ibolMLBg9kx9qiYIKWJbUzQ5sQFwWDMs5a0WUQGLuGljtwCWrqZ/GeH0Ek?= =?iso-8859-1?q?X8w8sVPlNUr4XIlowVCMpOKcsNddQN0sUuQBIxreZykiL/B6766PX/4bKcWD?= =?iso-8859-1?q?r94TaGtbBqFVb3Nc/i5g6fzmReK4lcmpRVljZvKQY50DPlpS3RBwB92E2m0x?= =?iso-8859-1?q?lYGjbhQCSyO2ID+BAWRE8KLmNm0zhWNpvFYcO8b9arhL4WybMFXJGgYwaDLf?= =?iso-8859-1?q?P3BPhpUYsSXYZWgpfk=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5342 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: AM5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 62ff4882-9148-45f9-c711-08d8b0ab51da X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DYJu6XfK5pPkx7guX7eje2+U/207hf9Py8G/2hyvqyhn7wwQzV1DeT6X9jExCoctkk0zO9lqLquZTbc6oEJLJi+Sd7r3mXSaQ8O6cipzfh+/yhkwg0XqJ3ND8/K+0ihWUF8loWrm7a+k4iZ2Ncd9+eiqW7DcINOo6YO1MBzLsZcYlxxhwzguxTXyb2CKKaOQxClB88nh4wjcblO+zp3Yvnswv7qmGYE0P5DFzn4AgkFivE1z+nVJdx9kn3/QGF5vK65PrmYvJapNb4VdtTb8njp8pr5kctQFZ5nXtfXwHWOBiW5IybdsMQA5QyYE4/lt1ePckmZH90GpCDJhTu0FuyrftGFG2tcemcP3yJn21Yve9jgRhVcVJB16h1oOL5DvxOPcwre9f8P+VfdvHHKPeQKtC5TP4RBBx5Rj2xcNG1HbO5zJwk2RFl+Zi1cazPmJvbrxS9CrwayouRQj48m0JA== 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)(376002)(39860400002)(346002)(136003)(396003)(46966006)(70586007)(5660300002)(6506007)(356005)(86362001)(7696005)(2906002)(82310400003)(81166007)(336012)(33656002)(70206006)(9686003)(55016002)(186003)(82740400003)(83380400001)(26005)(2940100002)(52536014)(30864003)(8936002)(8676002)(47076005)(6916009)(478600001)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2021 12:22:00.8067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dedb56ae-8762-48f2-7e12-08d8b0ab566a 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: AM5EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2827 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, 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-Patchwork-Original-From: Wilco Dijkstra via Libc-alpha From: Wilco Dijkstra Reply-To: Wilco Dijkstra Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Remove slow paths from atan2. Add ULP annotations. Passes GLIBC testsuite. diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h index de4300c5fc559f391e0b20a818452640dabb0e41..9cb8a1fbeae6ff2845151f23d49797c1218c0062 100644 --- a/sysdeps/ieee754/dbl-64/atnat2.h +++ b/sysdeps/ieee754/dbl-64/atnat2.h @@ -34,7 +34,7 @@ #define MM 5 #ifdef BIG_ENDI - static const number + static const mynumber /* polynomial I */ /**/ d3 = {{0xbfd55555, 0x55555555} }, /* -0.333... */ /**/ d5 = {{0x3fc99999, 0x999997fd} }, /* 0.199... */ @@ -96,7 +96,7 @@ #else #ifdef LITTLE_ENDI - static const number + static const mynumber /* polynomial I */ /**/ d3 = {{0x55555555, 0xbfd55555} }, /* -0.333... */ /**/ d5 = {{0x999997fd, 0x3fc99999} }, /* 0.199... */ diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c index 7af2a4f495d39f6450699de1d0d9d2f7a33fdcf7..5af12d37c3c89cac951d293339e811fd96d0daf3 100644 --- a/sysdeps/ieee754/dbl-64/e_atan2.c +++ b/sysdeps/ieee754/dbl-64/e_atan2.c @@ -20,25 +20,14 @@ /* MODULE_NAME: atnat2.c */ /* */ /* FUNCTIONS: uatan2 */ -/* atan2Mp */ /* signArctan2 */ -/* normalized */ /* */ -/* FILES NEEDED: dla.h endian.h mpa.h mydefs.h atnat2.h */ -/* mpatan.c mpatan2.c mpsqrt.c */ +/* FILES NEEDED: dla.h endian.h mydefs.h atnat2.h */ /* uatan.tbl */ /* */ -/* An ultimate atan2() routine. Given two IEEE double machine numbers y,*/ -/* x it computes the correctly rounded (to nearest) value of atan2(y,x).*/ -/* */ -/* Assumption: Machine arithmetic operations are performed in */ -/* round to nearest mode of IEEE 754 standard. */ -/* */ /************************************************************************/ #include -#include "mpa.h" -#include "MathLib.h" #include "mydefs.h" #include "uatan.tbl" #include "atnat2.h" @@ -48,20 +37,21 @@ #include #include #include -#include #include #ifndef SECTION # define SECTION #endif +#define TWO52 0x1.0p52 +#define TWOM1022 0x1.0p-1022 + /************************************************************************/ /* An ultimate atan2 routine. Given two IEEE double machine numbers y,x */ /* it computes the correctly rounded (to nearest) value of atan2(y,x). */ /* Assumption: Machine arithmetic operations are performed in */ /* round to nearest mode of IEEE 754 standard. */ /************************************************************************/ -static double atan2Mp (double, double, const int[]); /* Fix the sign and return after stage 1 or stage 2 */ static double signArctan2 (double y, double z) @@ -69,18 +59,14 @@ signArctan2 (double y, double z) return copysign (z, y); } -static double normalized (double, double, double, double); -void __mpatan2 (mp_no *, mp_no *, mp_no *, int); - double SECTION __ieee754_atan2 (double y, double x) { int i, de, ux, dx, uy, dy; - static const int pr[MM] = { 6, 8, 10, 20, 32 }; - double ax, ay, u, du, u9, ua, v, vv, dv, t1, t2, t3, - z, zz, cor, s1, ss1, s2, ss2; - number num; + double ax, ay, u, du, v, vv, dv, t1, t2, t3, + z, zz, cor; + mynumber num; static const int ep = 59768832, /* 57*16**5 */ em = -59768832; /* -57*16**5 */ @@ -208,10 +194,8 @@ __ieee754_atan2 (double y, double x) if (x > 0) { double ret; - if ((z = ay / ax) < TWOM1022) - ret = normalized (ax, ay, y, z); - else - ret = signArctan2 (y, z); + z = ay / ax; + ret = signArctan2 (y, z); if (fabs (ret) < DBL_MIN) { double vret = ret ? ret : DBL_MIN; @@ -270,30 +254,12 @@ __ieee754_atan2 (double y, double x) + v * (d11.d + v * d13.d))))); - if ((z = u + (zz - u1.d * u)) == u + (zz + u1.d * u)) - return signArctan2 (y, z); - - MUL2 (u, du, u, du, v, vv, t1, t2); - s1 = v * (f11.d + v * (f13.d - + v * (f15.d + v * (f17.d + v * f19.d)))); - ADD2 (f9.d, ff9.d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f7.d, ff7.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f5.d, ff5.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f3.d, ff3.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - MUL2 (u, du, s1, ss1, s2, ss2, t1, t2); - ADD2 (u, du, s2, ss2, s1, ss1, t1, t2); - - if ((z = s1 + (ss1 - u5.d * s1)) == s1 + (ss1 + u5.d * s1)) - return signArctan2 (y, z); - - return atan2Mp (x, y, pr); + z = u + zz; + /* Max ULP is 0.504. */ + return signArctan2 (y, z); } - i = (TWO52 + TWO8 * u) - TWO52; + i = (TWO52 + 256 * u) - TWO52; i -= 16; t3 = u - cij[i][0].d; EADD (t3, du, v, dv); @@ -304,43 +270,9 @@ __ieee754_atan2 (double y, double x) + v * (cij[i][4].d + v * (cij[i][5].d + v * cij[i][6].d)))); - if (i < 112) - { - if (i < 48) - u9 = u91.d; /* u < 1/4 */ - else - u9 = u92.d; - } /* 1/4 <= u < 1/2 */ - else - { - if (i < 176) - u9 = u93.d; /* 1/2 <= u < 3/4 */ - else - u9 = u94.d; - } /* 3/4 <= u <= 1 */ - if ((z = t1 + (zz - u9 * t1)) == t1 + (zz + u9 * t1)) - return signArctan2 (y, z); - - t1 = u - hij[i][0].d; - EADD (t1, du, v, vv); - s1 = v * (hij[i][11].d - + v * (hij[i][12].d - + v * (hij[i][13].d - + v * (hij[i][14].d - + v * hij[i][15].d)))); - ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][5].d, hij[i][6].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][3].d, hij[i][4].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2); - - if ((z = s2 + (ss2 - ub.d * s2)) == s2 + (ss2 + ub.d * s2)) - return signArctan2 (y, z); - return atan2Mp (x, y, pr); + z = t1 + zz; + /* Max ULP is 0.56. */ + return signArctan2 (y, z); } /* (ii) x>0, abs(x)<=abs(y): pi/2-atan(ax/ay) */ @@ -355,31 +287,12 @@ __ieee754_atan2 (double y, double x) + v * d13.d))))); ESUB (hpi.d, u, t2, cor); t3 = ((hpi1.d + cor) - du) - zz; - if ((z = t2 + (t3 - u2.d)) == t2 + (t3 + u2.d)) - return signArctan2 (y, z); - - MUL2 (u, du, u, du, v, vv, t1, t2); - s1 = v * (f11.d - + v * (f13.d - + v * (f15.d + v * (f17.d + v * f19.d)))); - ADD2 (f9.d, ff9.d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f7.d, ff7.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f5.d, ff5.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f3.d, ff3.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - MUL2 (u, du, s1, ss1, s2, ss2, t1, t2); - ADD2 (u, du, s2, ss2, s1, ss1, t1, t2); - SUB2 (hpi.d, hpi1.d, s1, ss1, s2, ss2, t1, t2); - - if ((z = s2 + (ss2 - u6.d)) == s2 + (ss2 + u6.d)) - return signArctan2 (y, z); - return atan2Mp (x, y, pr); + z = t2 + t3; + /* Max ULP is 0.501. */ + return signArctan2 (y, z); } - i = (TWO52 + TWO8 * u) - TWO52; + i = (TWO52 + 256 * u) - TWO52; i -= 16; v = (u - cij[i][0].d) + du; @@ -389,36 +302,9 @@ __ieee754_atan2 (double y, double x) + v * (cij[i][5].d + v * cij[i][6].d)))); t1 = hpi.d - cij[i][1].d; - if (i < 112) - ua = ua1.d; /* w < 1/2 */ - else - ua = ua2.d; /* w >= 1/2 */ - if ((z = t1 + (zz - ua)) == t1 + (zz + ua)) - return signArctan2 (y, z); - - t1 = u - hij[i][0].d; - EADD (t1, du, v, vv); - - s1 = v * (hij[i][11].d - + v * (hij[i][12].d - + v * (hij[i][13].d - + v * (hij[i][14].d - + v * hij[i][15].d)))); - - ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][5].d, hij[i][6].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][3].d, hij[i][4].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2); - SUB2 (hpi.d, hpi1.d, s2, ss2, s1, ss1, t1, t2); - - if ((z = s1 + (ss1 - uc.d)) == s1 + (ss1 + uc.d)) - return signArctan2 (y, z); - return atan2Mp (x, y, pr); + z = t1 + zz; + /* Max ULP is 0.503. */ + return signArctan2 (y, z); } /* (iii) x<0, abs(x)< abs(y): pi/2+atan(ax/ay) */ @@ -434,30 +320,12 @@ __ieee754_atan2 (double y, double x) + v * (d11.d + v * d13.d))))); EADD (hpi.d, u, t2, cor); t3 = ((hpi1.d + cor) + du) + zz; - if ((z = t2 + (t3 - u3.d)) == t2 + (t3 + u3.d)) - return signArctan2 (y, z); - - MUL2 (u, du, u, du, v, vv, t1, t2); - s1 = v * (f11.d - + v * (f13.d + v * (f15.d + v * (f17.d + v * f19.d)))); - ADD2 (f9.d, ff9.d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f7.d, ff7.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f5.d, ff5.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f3.d, ff3.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - MUL2 (u, du, s1, ss1, s2, ss2, t1, t2); - ADD2 (u, du, s2, ss2, s1, ss1, t1, t2); - ADD2 (hpi.d, hpi1.d, s1, ss1, s2, ss2, t1, t2); - - if ((z = s2 + (ss2 - u7.d)) == s2 + (ss2 + u7.d)) - return signArctan2 (y, z); - return atan2Mp (x, y, pr); + z = t2 + t3; + /* Max ULP is 0.501. */ + return signArctan2 (y, z); } - i = (TWO52 + TWO8 * u) - TWO52; + i = (TWO52 + 256 * u) - TWO52; i -= 16; v = (u - cij[i][0].d) + du; zz = hpi1.d + v * (cij[i][2].d @@ -466,34 +334,9 @@ __ieee754_atan2 (double y, double x) + v * (cij[i][5].d + v * cij[i][6].d)))); t1 = hpi.d + cij[i][1].d; - if (i < 112) - ua = ua1.d; /* w < 1/2 */ - else - ua = ua2.d; /* w >= 1/2 */ - if ((z = t1 + (zz - ua)) == t1 + (zz + ua)) - return signArctan2 (y, z); - - t1 = u - hij[i][0].d; - EADD (t1, du, v, vv); - s1 = v * (hij[i][11].d - + v * (hij[i][12].d - + v * (hij[i][13].d - + v * (hij[i][14].d - + v * hij[i][15].d)))); - ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][5].d, hij[i][6].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][3].d, hij[i][4].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2); - ADD2 (hpi.d, hpi1.d, s2, ss2, s1, ss1, t1, t2); - - if ((z = s1 + (ss1 - uc.d)) == s1 + (ss1 + uc.d)) - return signArctan2 (y, z); - return atan2Mp (x, y, pr); + z = t1 + zz; + /* Max ULP is 0.503. */ + return signArctan2 (y, z); } /* (iv) x<0, abs(y)<=abs(x): pi-atan(ax/ay) */ @@ -506,29 +349,12 @@ __ieee754_atan2 (double y, double x) + v * (d9.d + v * (d11.d + v * d13.d))))); ESUB (opi.d, u, t2, cor); t3 = ((opi1.d + cor) - du) - zz; - if ((z = t2 + (t3 - u4.d)) == t2 + (t3 + u4.d)) - return signArctan2 (y, z); - - MUL2 (u, du, u, du, v, vv, t1, t2); - s1 = v * (f11.d + v * (f13.d + v * (f15.d + v * (f17.d + v * f19.d)))); - ADD2 (f9.d, ff9.d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f7.d, ff7.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f5.d, ff5.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (f3.d, ff3.d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - MUL2 (u, du, s1, ss1, s2, ss2, t1, t2); - ADD2 (u, du, s2, ss2, s1, ss1, t1, t2); - SUB2 (opi.d, opi1.d, s1, ss1, s2, ss2, t1, t2); - - if ((z = s2 + (ss2 - u8.d)) == s2 + (ss2 + u8.d)) - return signArctan2 (y, z); - return atan2Mp (x, y, pr); + z = t2 + t3; + /* Max ULP is 0.501. */ + return signArctan2 (y, z); } - i = (TWO52 + TWO8 * u) - TWO52; + i = (TWO52 + 256 * u) - TWO52; i -= 16; v = (u - cij[i][0].d) + du; zz = opi1.d - v * (cij[i][2].d @@ -536,86 +362,11 @@ __ieee754_atan2 (double y, double x) + v * (cij[i][4].d + v * (cij[i][5].d + v * cij[i][6].d)))); t1 = opi.d - cij[i][1].d; - if (i < 112) - ua = ua1.d; /* w < 1/2 */ - else - ua = ua2.d; /* w >= 1/2 */ - if ((z = t1 + (zz - ua)) == t1 + (zz + ua)) - return signArctan2 (y, z); - - t1 = u - hij[i][0].d; - - EADD (t1, du, v, vv); - - s1 = v * (hij[i][11].d - + v * (hij[i][12].d - + v * (hij[i][13].d - + v * (hij[i][14].d + v * hij[i][15].d)))); - - ADD2 (hij[i][9].d, hij[i][10].d, s1, 0, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][7].d, hij[i][8].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][5].d, hij[i][6].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][3].d, hij[i][4].d, s1, ss1, s2, ss2, t1, t2); - MUL2 (v, vv, s2, ss2, s1, ss1, t1, t2); - ADD2 (hij[i][1].d, hij[i][2].d, s1, ss1, s2, ss2, t1, t2); - SUB2 (opi.d, opi1.d, s2, ss2, s1, ss1, t1, t2); - - if ((z = s1 + (ss1 - uc.d)) == s1 + (ss1 + uc.d)) - return signArctan2 (y, z); - return atan2Mp (x, y, pr); + z = t1 + zz; + /* Max ULP is 0.502. */ + return signArctan2 (y, z); } #ifndef __ieee754_atan2 libm_alias_finite (__ieee754_atan2, __atan2) #endif - -/* Treat the Denormalized case */ -static double -SECTION -normalized (double ax, double ay, double y, double z) -{ - int p; - mp_no mpx, mpy, mpz, mperr, mpz2, mpt1; - p = 6; - __dbl_mp (ax, &mpx, p); - __dbl_mp (ay, &mpy, p); - __dvd (&mpy, &mpx, &mpz, p); - __dbl_mp (ue.d, &mpt1, p); - __mul (&mpz, &mpt1, &mperr, p); - __sub (&mpz, &mperr, &mpz2, p); - __mp_dbl (&mpz2, &z, p); - return signArctan2 (y, z); -} - -/* Stage 3: Perform a multi-Precision computation */ -static double -SECTION -atan2Mp (double x, double y, const int pr[]) -{ - double z1, z2; - int i, p; - mp_no mpx, mpy, mpz, mpz1, mpz2, mperr, mpt1; - for (i = 0; i < MM; i++) - { - p = pr[i]; - __dbl_mp (x, &mpx, p); - __dbl_mp (y, &mpy, p); - __mpatan2 (&mpy, &mpx, &mpz, p); - __dbl_mp (ud[i].d, &mpt1, p); - __mul (&mpz, &mpt1, &mperr, p); - __add (&mpz, &mperr, &mpz1, p); - __sub (&mpz, &mperr, &mpz2, p); - __mp_dbl (&mpz1, &z1, p); - __mp_dbl (&mpz2, &z2, p); - if (z1 == z2) - { - LIBC_PROBE (slowatan2, 4, &p, &x, &y, &z1); - return z1; - } - } - LIBC_PROBE (slowatan2_inexact, 4, &p, &x, &y, &z1); - return z1; /*if impossible to do exact computing */ -} From patchwork Mon Jan 4 12:25:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 41623 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 723DE3857C6F; Mon, 4 Jan 2021 12:25:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 723DE3857C6F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609763150; bh=wl89LMST6bmfBHBc6E1gH5JK3tcUiktjnBzv/ap4QhQ=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=avefRicyR+yKTyklOvBE/lhjoPjcSiBvAYvfelXQ5F7i+izrlxUZ26XH3LmkMiSdF Eca7QlqUf+Z3ZorZy0Tq5sHCWx4hQZYDHGktT6SrS5TRbwk0H6duC9M1VT/ku6RA2z T6eTWKC26gssMzKAVhYGl5Yq7/fIuSizprDtosAU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80081.outbound.protection.outlook.com [40.107.8.81]) by sourceware.org (Postfix) with ESMTPS id E84E93857C6F for ; Mon, 4 Jan 2021 12:25:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E84E93857C6F Received: from DB7PR05CA0047.eurprd05.prod.outlook.com (2603:10a6:10:2e::24) by VI1PR0802MB2543.eurprd08.prod.outlook.com (2603:10a6:800:b5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.21; Mon, 4 Jan 2021 12:25:36 +0000 Received: from DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2e:cafe::4e) by DB7PR05CA0047.outlook.office365.com (2603:10a6:10:2e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20 via Frontend Transport; Mon, 4 Jan 2021 12:25:36 +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 DB5EUR03FT026.mail.protection.outlook.com (10.152.20.159) 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:25:36 +0000 Received: ("Tessian outbound 665ba7fbdfd9:v71"); Mon, 04 Jan 2021 12:25:35 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4732ab9d01622445 X-CR-MTA-TID: 64aa7808 Received: from d87dc4b8b20f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E41306A6-A75F-4700-BB25-DA297D5E4C9B.1; Mon, 04 Jan 2021 12:25:29 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d87dc4b8b20f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 04 Jan 2021 12:25:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WgK4jZ2ZTplgmvg9i4EHLb4StQesgE4X0EtSgrwe9mojOgfLel6m0qwDTD6t3j4EZmqdxWeMKDOkAVA1tP8T1DEp73W79Km7hENsanoSjuzQb7uKJK+tE/YHZmd3/Yq3mDnOrK0b+5O/gZrOSULiY16VZnSciWART6kUiK8Sb7lJpezjJU2EdptZvuk76S7Kedr7KQtG8Q4aHxParLNHHZEPt5jWZER5cDqjfAZYVw+iLhQq8Qtk7Q4e/itgfeyBlk03vzsjkZq5OwZTDoHai5tIVew4EmRoiYxtIxEpLiEqUlMuHN3DbclfR2Tk6vfE0pqmCpYjr5kUv4S4FV+CEg== 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=wl89LMST6bmfBHBc6E1gH5JK3tcUiktjnBzv/ap4QhQ=; b=LZu51ZwR6OYtMbc3YH2IOxkCL2A3m+D9kmyTxxB8q+ktHvxyzDZMv7RC7zxWJHxciyGCZVJUeyqnE3ZBSQ4ssZi43VGqDdFvBdcnKJDsQZsy5EBl8oEMslakVCeZ7fxo/6mtjCxkb0pi7BTRLEBLbFUGeG5waxHD3YMVRjvNeVusO+R3H9CpdvLeRepYaElY1O9E2IX6N36mrux2pjWjWVqwsn4G1jng6vLIkphqj1Es4kakX9Jue9Kd979PZyLqBPgrNpRYfFfvk6pCpaRj+BzN5sYkTV0ngGD/6X7dNeTBCQho79FOZfwiMOjtns0zK/+PGRD7POyU1hI3qEQ4wg== 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 VI1PR0802MB2158.eurprd08.prod.outlook.com (2603:10a6:800:99::14) 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:25:25 +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:25:25 +0000 To: 'GNU C Library' Subject: [PATCH 5/5] Remove mpa files Thread-Topic: [PATCH 5/5] Remove mpa files Thread-Index: AQHW4pStV/Eog8XYekCY8HYoeRN3uA== Date: Mon, 4 Jan 2021 12:25:24 +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: a8542466-350a-4244-4ad7-08d8b0abd6a7 x-ms-traffictypediagnostic: VI1PR0802MB2158:|VI1PR0802MB2543: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:229;OLM:229; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 8LxTn2Y71B4+Ph37Lu+MZs63xZKBZPX6HNL+keT42GSezSZu678HcCAsgOqoEeSWPRQCAi4DPJyC1prLEcV8UNgzM8VzVbB6HPgl6YE+na9QtyAOzIGAsU4DGw5KWHdEcgNQhRaeygGgeasuQwAGBJiS5U/Xto4/UQIwQ1NiAg6t2txLeW6FSJselN5ihbm8VIh/6zrT2SMenyayPUc2+p5UrwfYrFBXafSSw/NznKTJADedBYpsdGSBJN5mJMndExdwkGNXFl9yQ7LcBhNlFJ2BqdzxCijCrNYuv0MliMLsJtynlYP50BRmT2AZlePuyuFtIBkrRN3E2QsdS6WRJriPGupRHwhPmYUNBIqXP8BaMSVNnwks1f5AglFCoYTcVo65SM2fw3oVvJ0qlkjbXlRliQ9fRSM4Ti8sqCeH1Fm6WJGMaBGzcRBSNORCLTaBXp0txprvIri4+Bj/d7oz9xAn/OZzr0/4izDZ7UyJ4SsgYbTuH2aEROjWfUfMCdPfmiiGlNJa/FVuVOilNHudvK9h9XHIo42+yJkUACaS65I= 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)(39860400002)(376002)(366004)(136003)(346002)(396003)(8676002)(83380400001)(7696005)(86362001)(2906002)(6506007)(33656002)(26005)(316002)(19627235002)(5660300002)(2940100002)(52536014)(186003)(8936002)(478600001)(30864003)(76116006)(66946007)(9686003)(6916009)(91956017)(66476007)(71200400001)(66556008)(66446008)(64756008)(55016002)(2004002)(559001)(569008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?q?0osxk+OI7MYquw8nDQzsWHP5z?= =?iso-8859-1?q?F3H3lYLzi69ArgijIbA1+IFE27LpAIVQ9SGwg6dbW6iQHt5dmrzEHrlSlF0e?= =?iso-8859-1?q?wwRpRbLgngipfP87gTgHlu5Qjn3fD/v/yd/+5C8bSyRgUWRF3kre+8NykuLW?= =?iso-8859-1?q?DtqQHSPKnx3Mox8cYQvrw7qXnDF/tpMi63D2cqT5vQek0vIE56TSlbxBHeND?= =?iso-8859-1?q?GK/gtHrhjkK6aOojVFxPnCXfoS43iSlq6zP/V5kVve+wLn0rW8ZP7bBhSERq?= =?iso-8859-1?q?nvu9ki3RiEZ+syv5wQIwjh59HHCJo7WH80/8h/2JLlKRVvC7XMHEXIpZsBmN?= =?iso-8859-1?q?toXraousK6aZVvOToRHMiTcJkEdy6Y7np9JFh1whE2qU4AWNIyCt4ju3cgNi?= =?iso-8859-1?q?vTPaPZnJFmOAMw8iBCOaRTCFFFcWTOjWmT4YAYbVi7l6re46IqHB5xfl4nsB?= =?iso-8859-1?q?hv05CYsr72Yu+NGJk+rni9iCVXU1zL2tXaO1lb8a/Cx1e70lucQCuc+yLU/R?= =?iso-8859-1?q?c59jjpRGQvSTLxVq1UW5mQdSdLNg07cf0OGjk6H81XvQ74Z+JO4/gELea6dz?= =?iso-8859-1?q?f0UMfiboduI0CMYUFREaJcMocNHnRB2mq9xJfNenRP4BElC2TXi7O+iRJxfB?= =?iso-8859-1?q?vAqh/pvM9ZDtsJ5lyTNTNGxzyBRmjk7lrWDl3Ni8Y45zrFGCaAp7vSK691FE?= =?iso-8859-1?q?UcI4CeAmCimx0au16Poje+y5PXTXB8oXp1l8kouRGMLAbgpS6ZIz/IMntXdi?= =?iso-8859-1?q?p5v6bpweRe/V67StbV6aKeewv2hSupvxfIkb2jOIvcejslUMCswfIC/9gp4o?= =?iso-8859-1?q?AP66ChMZiszrS6m1WmKEMWfsG9LhYcS4hXaUUYOinzIA03EjCzgES9sHdfMb?= =?iso-8859-1?q?cnXdt4CbafqObnpBFWGVbqljF0/AwaZUiHpN3w+cN40wwOcZ8e8AZbrGkhMD?= =?iso-8859-1?q?G+21S/s7pFfyCd1oqLIQuQsdOaGCq/oyLiZuEedYbrdp9CT+VOJKJjcl6hf3?= =?iso-8859-1?q?DeGwuTdbvRqMsdpAmA=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2158 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: DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 2fb26dae-a9a8-4a4a-3133-08d8b0abd023 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: assAzYmj75fVCbJXK5WJtA+p6rreIDKaO9ykUXXW3RKuFnItigdSAv1nqJPrtFgHkzVHpY095CpkZojvK0n54pDVEaR4uDyjqeC4myXvRJujUuF/n2BJv0vNMr01gOZYYeNwDpfCkdgPGtgQYQAnbofsGl4UVlRHGMkpRJ3keBBmf205bKk9ZjJVlnOtKFen0zKeIDLkS5gac36KFFusPksno2Sc5I2QOZlfEICKxFTCTUpsvIrILl3A1krnw0D7oCdcrzMPQBhgGurnb0SmXI4rrAKBLES5NUD0TUZWGqtmjJJrYxCK/VkZxTu9JmwsKig2kraf2cIq3YXmYniJZgqUpyZ8Ta1bqKo4REooFVde6pij0C5gTRhInAfip1A4FeWGksHFHaTaSVpanssWnbjBjkSxtUJyBYCCPE/dxcZ/1NKe80s5rAvNDxKti2QBmAaosIPMxHSzSQtwJECiE1i8nfqLWfE2yK0VWgdrHZBa2Rxb8tKqijDzXF4qajxfWrUKi0oYpAJ+oDaEnMJvcfK7/MaXyHl90roTdu1EsHf+nqn7pwf450+HB9BLCIup 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)(376002)(136003)(396003)(46966006)(9686003)(55016002)(8936002)(478600001)(30864003)(19627235002)(5660300002)(52536014)(47076005)(2906002)(336012)(6506007)(186003)(26005)(70586007)(356005)(81166007)(83380400001)(70206006)(8676002)(33656002)(7696005)(82740400003)(6916009)(316002)(2940100002)(86362001)(82310400003)(2004002)(559001)(579004); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2021 12:25:36.0039 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8542466-350a-4244-4ad7-08d8b0abd6a7 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: DB5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2543 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SHORT, 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-Patchwork-Original-From: Wilco Dijkstra via Libc-alpha From: Wilco Dijkstra Reply-To: Wilco Dijkstra Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Finally remove all mpa related files, headers, declarations, probes and update makefiles. Passes GLIBC testsuite and buildmanyglibc. diff --git a/manual/probes.texi b/manual/probes.texi index 61254bc43018d0618c17776603c95c2f8d489678..4aae76b81921f3474e381b2d0c982e9bec1c6380 100644 --- a/manual/probes.texi +++ b/manual/probes.texi @@ -16,7 +16,6 @@ arguments. @menu * Memory Allocation Probes:: Probes in the memory allocation subsystem -* Mathematical Function Probes:: Probes in mathematical functions * Non-local Goto Probes:: Probes in setjmp and longjmp @end menu @@ -255,90 +254,6 @@ is the memory location as passed to @code{free}, Argument @var{$arg2} is the tcache bin it resides in. @end deftp -@node Mathematical Function Probes -@section Mathematical Function Probes - -Some mathematical functions fall back to multiple precision arithmetic for -some inputs to get last bit precision for their return values. This multiple -precision fallback is much slower than the default algorithms and may have a -significant impact on application performance. The systemtap probe markers -described in this section may help you determine if your application calls -mathematical functions with inputs that may result in multiple-precision -arithmetic. - -Unless explicitly mentioned otherwise, a precision of 1 implies 24 bits of -precision in the mantissa of the multiple precision number. Hence, a precision -level of 32 implies 768 bits of precision in the mantissa. - -@deftp Probe slowatan2 (int @var{$arg1}, double @var{$arg2}, double @var{$arg3}, double @var{$arg4}) -This probe is triggered when the @code{atan2} function is called with -an input that results in multiple precision computation. Argument -@var{$arg1} is the precision with which computation succeeded. -Arguments @var{$arg2} and @var{$arg3} are inputs to the @code{atan2} -function and @var{$arg4} is the computed result. -@end deftp - -@deftp Probe slowatan2_inexact (int @var{$arg1}, double @var{$arg2}, double @var{$arg3}, double @var{$arg4}) -This probe is triggered when the @code{atan} function is called with -an input that results in multiple precision computation and none of -the multiple precision computations result in an accurate result. -Argument @var{$arg1} is the maximum precision with which computations -were performed. Arguments @var{$arg2} and @var{$arg3} are inputs to -the @code{atan2} function and @var{$arg4} is the computed result. -@end deftp - -@deftp Probe slowatan (int @var{$arg1}, double @var{$arg2}, double @var{$arg3}) -This probe is triggered when the @code{atan} function is called with -an input that results in multiple precision computation. Argument -@var{$arg1} is the precision with which computation succeeded. -Argument @var{$arg2} is the input to the @code{atan} function and -@var{$arg3} is the computed result. -@end deftp - -@deftp Probe slowatan_inexact (int @var{$arg1}, double @var{$arg2}, double @var{$arg3}) -This probe is triggered when the @code{atan} function is called with -an input that results in multiple precision computation and none of -the multiple precision computations result in an accurate result. -Argument @var{$arg1} is the maximum precision with which computations -were performed. Argument @var{$arg2} is the input to the @code{atan} -function and @var{$arg3} is the computed result. -@end deftp - -@deftp Probe slowtan (double @var{$arg1}, double @var{$arg2}) -This probe is triggered when the @code{tan} function is called with an -input that results in multiple precision computation with precision -32. Argument @var{$arg1} is the input to the function and @var{$arg2} -is the computed result. -@end deftp - -@deftp Probe slowsin (double @var{$arg1}, double @var{$arg2}) -This probe is triggered when the @code{sin} function is called with an -input that results in multiple precision computation with precision -32. Argument @var{$arg1} is the input to the function and @var{$arg2} -is the computed result. -@end deftp - -@deftp Probe slowcos (double @var{$arg1}, double @var{$arg2}) -This probe is triggered when the @code{cos} function is called with an -input that results in multiple precision computation with precision -32. Argument @var{$arg1} is the input to the function and @var{$arg2} -is the computed result. -@end deftp - -@deftp Probe slowsin_dx (double @var{$arg1}, double @var{$arg2}, double @var{$arg3}) -This probe is triggered when the @code{sin} function is called with an -input that results in multiple precision computation with precision -32. Argument @var{$arg1} is the input to the function, @var{$arg2} is -the error bound of @var{$arg1} and @var{$arg3} is the computed result. -@end deftp - -@deftp Probe slowcos_dx (double @var{$arg1}, double @var{$arg2}, double @var{$arg3}) -This probe is triggered when the @code{cos} function is called with an -input that results in multiple precision computation with precision -32. Argument @var{$arg1} is the input to the function, @var{$arg2} is -the error bound of @var{$arg1} and @var{$arg3} is the computed result. -@end deftp - @node Non-local Goto Probes @section Non-local Goto Probes diff --git a/math/Makefile b/math/Makefile index 62667d9186c601d88e87cdbd2e98d6231c96e7fb..80855cc356923170c99fe38128625e338aedb247 100644 --- a/math/Makefile +++ b/math/Makefile @@ -126,8 +126,7 @@ type-ldouble-yes := ldouble # double support type-double-suffix := -type-double-routines := branred doasin dosincos mpa mpatan2 \ - k_rem_pio2 mpatan mpsqrt mptan sincos32 \ +type-double-routines := branred k_rem_pio2 \ sincostab math_err e_exp_data e_log_data \ e_log2_data e_pow_log_data diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h index 10a6fde28dbcbfe55148c744e13515b7c9d0707c..98b54875f51304f966db6d7b304b12073f9b2b2f 100644 --- a/sysdeps/generic/math_private.h +++ b/sysdeps/generic/math_private.h @@ -199,11 +199,5 @@ do { \ extern double __sin (double __x); extern double __cos (double __x); extern int __branred (double __x, double *__a, double *__aa); -extern void __doasin (double __x, double __dx, double __v[]); -extern void __dubsin (double __x, double __dx, double __v[]); -extern void __dubcos (double __x, double __dx, double __v[]); -extern double __mpsin (double __x, double __dx, bool __range_reduce); -extern double __mpcos (double __x, double __dx, bool __range_reduce); -extern void __docos (double __x, double __dx, double __v[]); #endif /* _MATH_PRIVATE_H_ */ diff --git a/sysdeps/ieee754/dbl-64/MathLib.h b/sysdeps/ieee754/dbl-64/MathLib.h deleted file mode 100644 index a273082f93e60fa826c4105d9457e8b4185b2357..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/MathLib.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * Written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ - -/********************************************************************/ -/* Ultimate math functions. Each function computes the exact */ -/* theoretical value of its argument rounded to nearest or even. */ -/* */ -/* Assumption: Machine arithmetic operations are performed in */ -/* round nearest mode of IEEE 754 standard. */ -/********************************************************************/ - -#ifndef UMATH_LIB -#define UMATH_LIB -/********************************************************************/ -/* Function changes the precision mode to IEEE 754 double precision */ -/* and the rounding mode to nearest or even. */ -/* It returns the original status of these modes. */ -/* See further explanations of usage in DPChange.h */ -/********************************************************************/ -unsigned short Init_Lib (void); - -/********************************************************************/ -/* Function that changes the precision and rounding modes to the */ -/* specified by the argument received. See further explanations in */ -/* DPChange.h */ -/********************************************************************/ -void Exit_Lib (unsigned short); - - -/* The asin() function calculates the arc sine of its argument. */ -/* The function returns the arc sine in radians */ -/* (between -PI/2 and PI/2). */ -/* If the argument is greater than 1 or less than -1 it returns */ -/* a NaN. */ -double uasin (double); - - -/* The acos() function calculates the arc cosine of its argument. */ -/* The function returns the arc cosine in radians */ -/* (between -PI/2 and PI/2). */ -/* If the argument is greater than 1 or less than -1 it returns */ -/* a NaN. */ -double uacos (double); - -/* The atan() function calculates the arctanget of its argument. */ -/* The function returns the arc tangent in radians */ -/* (between -PI/2 and PI/2). */ -double uatan (double); - - -/* The uatan2() function calculates the arc tangent of the two arguments x */ -/* and y (x is the right argument and y is the left one).The signs of both */ -/* arguments are used to determine the quadrant of the result. */ -/* The function returns the result in radians, which is between -PI and PI */ -double uatan2 (double, double); - -/* Compute log(x). The base of log is e (natural logarithm) */ -double ulog (double); - -/* Compute e raised to the power of argument x. */ -double uexp (double); - -/* Compute sin(x). The argument x is assumed to be given in radians.*/ -double usin (double); - -/* Compute cos(x). The argument x is assumed to be given in radians.*/ -double ucos (double); - -/* Compute tan(x). The argument x is assumed to be given in radians.*/ -double utan (double); - -/* Compute the square root of non-negative argument x. */ -/* If x is negative the returned value is NaN. */ -double usqrt (double); - -/* Compute x raised to the power of y, where x is the left argument */ -/* and y is the right argument. The function returns a NaN if x<0. */ -/* If x equals zero it returns -inf */ -double upow (double, double); - -/* Computing x mod y, where x is the left argument and y is the */ -/* right one. */ -double uremainder (double, double); -#endif diff --git a/sysdeps/ieee754/dbl-64/doasin.h b/sysdeps/ieee754/dbl-64/doasin.h deleted file mode 100644 index ecb15aaff00a79b0acc3f3d9ec1a083fc2f702d5..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/doasin.h +++ /dev/null @@ -1,63 +0,0 @@ - -/* - * IBM Accurate Mathematical Library - * Written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ - -/************************************************************************/ -/* MODULE_NAME: doasin.h */ -/* */ -/* */ -/* common data and variables definition for BIG or LITTLE ENDIAN */ -/************************************************************************/ - - - -#ifndef DOASIN_H -#define DOASIN_H - -#ifdef BIG_ENDI - - static const mynumber -/**/ c1 = {{0x3FC55555, 0x55555555}}, /* 0.16666666666666666 */ -/**/ cc1 = {{0x3C655555, 0x55775389}}, /* 9.2518585419753846e-18 */ -/**/ c2 = {{0x3FB33333, 0x33333333}}, /* 0.074999999999999997 */ -/**/ cc2 = {{0x3C499993, 0x63F1A115}}, /* 2.7755472886508899e-18 */ -/**/ c3 = {{0x3FA6DB6D, 0xB6DB6DB7}}, /* 0.044642857142857144 */ -/**/ cc3 = {{0xBC320FC0, 0x3D5CF0C5}}, /* -9.7911734574147224e-19 */ -/**/ c4 = {{0x3F9F1C71, 0xC71C71C5}}, /* 0.030381944444444437 */ -/**/ cc4 = {{0xBC02B240, 0xFF23ED1E}}; /* -1.2669108566898312e-19 */ - -#else -#ifdef LITTLE_ENDI - - static const mynumber -/**/ c1 = {{0x55555555, 0x3FC55555}}, /* 0.16666666666666666 */ -/**/ cc1 = {{0x55775389, 0x3C655555}}, /* 9.2518585419753846e-18 */ -/**/ c2 = {{0x33333333, 0x3FB33333}}, /* 0.074999999999999997 */ -/**/ cc2 = {{0x63F1A115, 0x3C499993}}, /* 2.7755472886508899e-18 */ -/**/ c3 = {{0xB6DB6DB7, 0x3FA6DB6D}}, /* 0.044642857142857144 */ -/**/ cc3 = {{0x3D5CF0C5, 0xBC320FC0}}, /* -9.7911734574147224e-19 */ -/**/ c4 = {{0xC71C71C5, 0x3F9F1C71}}, /* 0.030381944444444437 */ -/**/ cc4 = {{0xFF23ED1E, 0xBC02B240}}; /* -1.2669108566898312e-19 */ - - -#endif -#endif - - -#endif diff --git a/sysdeps/ieee754/dbl-64/doasin.c b/sysdeps/ieee754/dbl-64/doasin.c deleted file mode 100644 index f7e2f455664421dfd3a22bdf46aa598c14cb6093..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/doasin.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/**********************************************************************/ -/* MODULE_NAME: doasin.c */ -/* */ -/* FUNCTION: doasin */ -/* */ -/* FILES NEEDED:endian.h mydefs.h dla.h doasin.h */ -/* mpa.c */ -/* */ -/* Compute arcsin(x,dx,v) of double-length number (x+dx) the result */ -/* stored in v where v= v[0]+v[1] =arcsin(x+dx) */ -/**********************************************************************/ - -#include "endian.h" -#include "mydefs.h" -#include -#include - -#ifndef SECTION -# define SECTION -#endif - -/********************************************************************/ -/* Compute arcsin(x,dx,v) of double-length number (x+dx) the result */ -/* stored in v where v= v[0]+v[1] =arcsin(x+dx) */ -/********************************************************************/ -void -SECTION -__doasin(double x, double dx, double v[]) { - -#include "doasin.h" - - static const double - d5 = 0.22372159090911789889975459505194491E-01, - d6 = 0.17352764422456822913014975683014622E-01, - d7 = 0.13964843843786693521653681033981614E-01, - d8 = 0.11551791438485242609036067259086589E-01, - d9 = 0.97622386568166960207425666787248914E-02, - d10 = 0.83638737193775788576092749009744976E-02, - d11 = 0.79470250400727425881446981833568758E-02; - - double xx,p,pp,u,uu,r,s; - double tc,tcc; - - -/* Taylor series for arcsin for Double-Length numbers */ - xx = x*x+2.0*x*dx; - p = ((((((d11*xx+d10)*xx+d9)*xx+d8)*xx+d7)*xx+d6)*xx+d5)*xx; - pp = 0; - - MUL2(x,dx,x,dx,u,uu,tc,tcc); - ADD2(p,pp,c4.x,cc4.x,p,pp,r,s); - MUL2(p,pp,u,uu,p,pp,tc,tcc); - ADD2(p,pp,c3.x,cc3.x,p,pp,r,s); - MUL2(p,pp,u,uu,p,pp,tc,tcc); - ADD2(p,pp,c2.x,cc2.x,p,pp,r,s); - MUL2(p,pp,u,uu,p,pp,tc,tcc); - ADD2(p,pp,c1.x,cc1.x,p,pp,r,s); - MUL2(p,pp,u,uu,p,pp,tc,tcc); - MUL2(p,pp,x,dx,p,pp,tc,tcc); - ADD2(p,pp,x,dx,p,pp,r,s); - v[0]=p; - v[1]=pp; /* arcsin(x+dx)=v[0]+v[1] */ -} diff --git a/sysdeps/ieee754/dbl-64/dosincos.h b/sysdeps/ieee754/dbl-64/dosincos.h deleted file mode 100644 index a90667ebc0bdd3045626aade77374689a0a07732..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/dosincos.h +++ /dev/null @@ -1,80 +0,0 @@ - -/* - * IBM Accurate Mathematical Library - * Written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ - -/************************************************************************/ -/* MODULE_NAME: dosincos.h */ -/* */ -/* */ -/* common data and variables definition for BIG or LITTLE ENDIAN */ -/************************************************************************/ - - - -#ifndef DOSINCOS_H -#define DOSINCOS_H - - -#ifdef BIG_ENDI -static const mynumber -/**/ s3 = {{0xBFC55555, 0x55555555}},/* -0.16666666666666666 */ -/**/ ss3 = {{0xBC6553AA, 0xE77EE482}},/* -9.2490366677784492e-18 */ -/**/ s5 = {{0x3F811111, 0x11110F15}},/* 0.008333333333332452 */ -/**/ ss5 = {{0xBC21AC06, 0xDA488820}},/* -4.7899996586987931e-19 */ -/**/ s7 = {{0xBF2A019F, 0x5816C78D}},/* -0.00019841261022928957 */ -/**/ ss7 = {{0x3BCDCEC9, 0x6A18BF2A}},/* 1.2624077757871259e-20 */ -/**/ c2 = {{0x3FE00000, 0x00000000}},/* 0.5 */ -/**/ cc2 = {{0xBA282FD8, 0x00000000}},/* -1.5264073330037701e-28 */ -/**/ c4 = {{0xBFA55555, 0x55555555}},/* -0.041666666666666664 */ -/**/ cc4 = {{0xBC4554BC, 0x2FFF257E}},/* -2.312711276085743e-18 */ -/**/ c6 = {{0x3F56C16C, 0x16C16A96}},/* 0.0013888888888888055 */ -/**/ cc6 = {{0xBBD2E846, 0xE6346F14}},/* -1.6015133010194884e-20 */ -/**/ c8 = {{0xBEFA019F, 0x821D5987}},/* -2.480157866754367e-05 */ -/**/ cc8 = {{0x3B7AB71E, 0x72FFE5CC}},/* 3.5357416224857556e-22 */ - -/**/ big = {{0x42c80000, 0x00000000}}, /* 52776558133248 */ - -/**/ hp0 = {{0x3FF921FB, 0x54442D18}}, /* PI / 2 */ -/**/ hp1 = {{0x3C91A626, 0x33145C07}}; /* 6.123233995736766e-17 */ -#else -#ifdef LITTLE_ENDI -static const mynumber -/**/ s3 = {{0x55555555, 0xBFC55555}},/* -0.16666666666666666 */ -/**/ ss3 = {{0xE77EE482, 0xBC6553AA}},/* -9.2490366677784492e-18 */ -/**/ s5 = {{0x11110F15, 0x3F811111}},/* 0.008333333333332452 */ -/**/ ss5 = {{0xDA488820, 0xBC21AC06}},/* -4.7899996586987931e-19 */ -/**/ s7 = {{0x5816C78D, 0xBF2A019F}},/* -0.00019841261022928957 */ -/**/ ss7 = {{0x6A18BF2A, 0x3BCDCEC9}},/* 1.2624077757871259e-20 */ -/**/ c2 = {{0x00000000, 0x3FE00000}},/* 0.5 */ -/**/ cc2 = {{0x00000000, 0xBA282FD8}},/* -1.5264073330037701e-28 */ -/**/ c4 = {{0x55555555, 0xBFA55555}},/* -0.041666666666666664 */ -/**/ cc4 = {{0x2FFF257E, 0xBC4554BC}},/* -2.312711276085743e-18 */ -/**/ c6 = {{0x16C16A96, 0x3F56C16C}},/* 0.0013888888888888055 */ -/**/ cc6 = {{0xE6346F14, 0xBBD2E846}},/* -1.6015133010194884e-20 */ -/**/ c8 = {{0x821D5987, 0xBEFA019F}},/* -2.480157866754367e-05 */ -/**/ cc8 = {{0x72FFE5CC, 0x3B7AB71E}},/* 3.5357416224857556e-22 */ - -/**/ big = {{0x00000000, 0x42c80000}}, /* 52776558133248 */ - -/**/ hp0 = {{0x54442D18, 0x3FF921FB}}, /* PI / 2 */ -/**/ hp1 = {{0x33145C07, 0x3C91A626}}; /* 6.123233995736766e-17 */ -#endif -#endif - -#endif diff --git a/sysdeps/ieee754/dbl-64/dosincos.c b/sysdeps/ieee754/dbl-64/dosincos.c deleted file mode 100644 index 51b2938650140057f49b372a2695d56b02639f58..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/dosincos.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/********************************************************************/ -/* */ -/* MODULE_NAME: dosincos.c */ -/* */ -/* */ -/* FUNCTIONS: dubsin */ -/* dubcos */ -/* docos */ -/* FILES NEEDED: endian.h mydefs.h dla.h dosincos.h */ -/* sincos.tbl */ -/* */ -/* Routines compute sin() and cos() as Double-Length numbers */ -/********************************************************************/ - - - -#include "endian.h" -#include "mydefs.h" -#include -#include "dosincos.h" -#include - -#ifndef SECTION -# define SECTION -#endif - -extern const union -{ - int4 i[880]; - double x[440]; -} __sincostab attribute_hidden; - -/***********************************************************************/ -/* Routine receive Double-Length number (x+dx) and computing sin(x+dx) */ -/* as Double-Length number and store it at array v .It computes it by */ -/* arithmetic action on Double-Length numbers */ -/*(x+dx) between 0 and PI/4 */ -/***********************************************************************/ - -void -SECTION -__dubsin (double x, double dx, double v[]) -{ - double r, s, c, cc, d, dd, d2, dd2, e, ee, - sn, ssn, cs, ccs, ds, dss, dc, dcc; - mynumber u; - int4 k; - - u.x = x + big.x; - k = u.i[LOW_HALF] << 2; - x = x - (u.x - big.x); - d = x + dx; - dd = (x - d) + dx; - /* sin(x+dx)=sin(Xi+t)=sin(Xi)*cos(t) + cos(Xi)sin(t) where t ->0 */ - MUL2 (d, dd, d, dd, d2, dd2, c, cc); - sn = __sincostab.x[k]; /* */ - ssn = __sincostab.x[k + 1]; /* sin(Xi) and cos(Xi) */ - cs = __sincostab.x[k + 2]; /* */ - ccs = __sincostab.x[k + 3]; /* */ - /* Taylor series for sin ds=sin(t) */ - MUL2 (d2, dd2, s7.x, ss7.x, ds, dss, c, cc); - ADD2 (ds, dss, s5.x, ss5.x, ds, dss, r, s); - MUL2 (d2, dd2, ds, dss, ds, dss, c, cc); - ADD2 (ds, dss, s3.x, ss3.x, ds, dss, r, s); - MUL2 (d2, dd2, ds, dss, ds, dss, c, cc); - MUL2 (d, dd, ds, dss, ds, dss, c, cc); - ADD2 (ds, dss, d, dd, ds, dss, r, s); - - /* Taylor series for cos dc=cos(t) */ - MUL2 (d2, dd2, c8.x, cc8.x, dc, dcc, c, cc); - ADD2 (dc, dcc, c6.x, cc6.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - ADD2 (dc, dcc, c4.x, cc4.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - ADD2 (dc, dcc, c2.x, cc2.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - - MUL2 (cs, ccs, ds, dss, e, ee, c, cc); - MUL2 (dc, dcc, sn, ssn, dc, dcc, c, cc); - SUB2 (e, ee, dc, dcc, e, ee, r, s); - ADD2 (e, ee, sn, ssn, e, ee, r, s); /* e+ee=sin(x+dx) */ - - v[0] = e; - v[1] = ee; -} -/**********************************************************************/ -/* Routine receive Double-Length number (x+dx) and computes cos(x+dx) */ -/* as Double-Length number and store it in array v .It computes it by */ -/* arithmetic action on Double-Length numbers */ -/*(x+dx) between 0 and PI/4 */ -/**********************************************************************/ - -void -SECTION -__dubcos (double x, double dx, double v[]) -{ - double r, s, c, cc, d, dd, d2, dd2, e, ee, - sn, ssn, cs, ccs, ds, dss, dc, dcc; - mynumber u; - int4 k; - u.x = x + big.x; - k = u.i[LOW_HALF] << 2; - x = x - (u.x - big.x); - d = x + dx; - dd = (x - d) + dx; /* cos(x+dx)=cos(Xi+t)=cos(Xi)cos(t) - sin(Xi)sin(t) */ - MUL2 (d, dd, d, dd, d2, dd2, c, cc); - sn = __sincostab.x[k]; /* */ - ssn = __sincostab.x[k + 1]; /* sin(Xi) and cos(Xi) */ - cs = __sincostab.x[k + 2]; /* */ - ccs = __sincostab.x[k + 3]; /* */ - MUL2 (d2, dd2, s7.x, ss7.x, ds, dss, c, cc); - ADD2 (ds, dss, s5.x, ss5.x, ds, dss, r, s); - MUL2 (d2, dd2, ds, dss, ds, dss, c, cc); - ADD2 (ds, dss, s3.x, ss3.x, ds, dss, r, s); - MUL2 (d2, dd2, ds, dss, ds, dss, c, cc); - MUL2 (d, dd, ds, dss, ds, dss, c, cc); - ADD2 (ds, dss, d, dd, ds, dss, r, s); - - MUL2 (d2, dd2, c8.x, cc8.x, dc, dcc, c, cc); - ADD2 (dc, dcc, c6.x, cc6.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - ADD2 (dc, dcc, c4.x, cc4.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - ADD2 (dc, dcc, c2.x, cc2.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - - MUL2 (cs, ccs, ds, dss, e, ee, c, cc); - MUL2 (dc, dcc, sn, ssn, dc, dcc, c, cc); - - MUL2 (d2, dd2, s7.x, ss7.x, ds, dss, c, cc); - ADD2 (ds, dss, s5.x, ss5.x, ds, dss, r, s); - MUL2 (d2, dd2, ds, dss, ds, dss, c, cc); - ADD2 (ds, dss, s3.x, ss3.x, ds, dss, r, s); - MUL2 (d2, dd2, ds, dss, ds, dss, c, cc); - MUL2 (d, dd, ds, dss, ds, dss, c, cc); - ADD2 (ds, dss, d, dd, ds, dss, r, s); - MUL2 (d2, dd2, c8.x, cc8.x, dc, dcc, c, cc); - ADD2 (dc, dcc, c6.x, cc6.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - ADD2 (dc, dcc, c4.x, cc4.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - ADD2 (dc, dcc, c2.x, cc2.x, dc, dcc, r, s); - MUL2 (d2, dd2, dc, dcc, dc, dcc, c, cc); - MUL2 (sn, ssn, ds, dss, e, ee, c, cc); - MUL2 (dc, dcc, cs, ccs, dc, dcc, c, cc); - ADD2 (e, ee, dc, dcc, e, ee, r, s); - SUB2 (cs, ccs, e, ee, e, ee, r, s); - - v[0] = e; - v[1] = ee; -} -/**********************************************************************/ -/* Routine receive Double-Length number (x+dx) and computes cos(x+dx) */ -/* as Double-Length number and store it in array v */ -/**********************************************************************/ -void -SECTION -__docos (double x, double dx, double v[]) -{ - double y, yy, p, w[2]; - if (x > 0) - { - y = x; yy = dx; - } - else - { - y = -x; yy = -dx; - } - if (y < 0.5 * hp0.x) /* y< PI/4 */ - { - __dubcos (y, yy, w); v[0] = w[0]; v[1] = w[1]; - } - else if (y < 1.5 * hp0.x) /* y< 3/4 * PI */ - { - p = hp0.x - y; /* p = PI/2 - y */ - yy = hp1.x - yy; - y = p + yy; - yy = (p - y) + yy; - if (y > 0) - { - __dubsin (y, yy, w); v[0] = w[0]; v[1] = w[1]; - } - /* cos(x) = sin ( 90 - x ) */ - else - { - __dubsin (-y, -yy, w); v[0] = -w[0]; v[1] = -w[1]; - } - } - else /* y>= 3/4 * PI */ - { - p = 2.0 * hp0.x - y; /* p = PI- y */ - yy = 2.0 * hp1.x - yy; - y = p + yy; - yy = (p - y) + yy; - __dubcos (y, yy, w); - v[0] = -w[0]; - v[1] = -w[1]; - } -} diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c index bee5e5f1477bcf5e1411b1424bfe3083fec670ed..895345a2f021aa8b9d0b206227088a1e96e2f54b 100644 --- a/sysdeps/ieee754/dbl-64/e_remainder.c +++ b/sysdeps/ieee754/dbl-64/e_remainder.c @@ -32,7 +32,6 @@ #include "endian.h" #include "mydefs.h" #include "urem.h" -#include "MathLib.h" #include #include #include diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c index c183d39938fe24262ffbb7fc49f4b6afb3cacc11..c4156cfd4578019770306c9de36c03db331352eb 100644 --- a/sysdeps/ieee754/dbl-64/e_sqrt.c +++ b/sysdeps/ieee754/dbl-64/e_sqrt.c @@ -35,7 +35,6 @@ #include "endian.h" #include "mydefs.h" #include -#include "MathLib.h" #include "root.tbl" #include #include diff --git a/sysdeps/ieee754/dbl-64/mpa-arch.h b/sysdeps/ieee754/dbl-64/mpa-arch.h deleted file mode 100644 index 0b33cb89d06e72d1cf370f5616cc624cd745e306..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mpa-arch.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Overridable constants and operations. - Copyright (C) 2013-2020 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program; if not, see . */ - -#include - -typedef long mantissa_t; -typedef int64_t mantissa_store_t; - -#define TWOPOW(i) (1L << i) - -#define RADIX_EXP 24 -#define RADIX TWOPOW (RADIX_EXP) /* 2^24 */ - -/* Divide D by RADIX and put the remainder in R. D must be a non-negative - integral value. */ -#define DIV_RADIX(d, r) \ - ({ \ - r = d & (RADIX - 1); \ - d >>= RADIX_EXP; \ - }) - -/* Put the integer component of a double X in R and retain the fraction in - X. This is used in extracting mantissa digits for MP_NO by using the - integer portion of the current value of the number as the current mantissa - digit and then scaling by RADIX to get the next mantissa digit in the same - manner. */ -#define INTEGER_OF(x, i) \ - ({ \ - i = (mantissa_t) x; \ - x -= i; \ - }) - -/* Align IN down to F. The code assumes that F is a power of two. */ -#define ALIGN_DOWN_TO(in, f) ((in) & - (f)) diff --git a/sysdeps/ieee754/dbl-64/mpa.h b/sysdeps/ieee754/dbl-64/mpa.h deleted file mode 100644 index 76656610b946d695619878b776fb83d2a6b5b284..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mpa.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * Written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ - -/************************************************************************/ -/* MODULE_NAME: mpa.h */ -/* */ -/* FUNCTIONS: */ -/* mcr */ -/* acr */ -/* cpy */ -/* mp_dbl */ -/* dbl_mp */ -/* add */ -/* sub */ -/* mul */ -/* dvd */ -/* */ -/* Arithmetic functions for multiple precision numbers. */ -/* Common types and definition */ -/************************************************************************/ - -#include - -/* The mp_no structure holds the details of a multi-precision floating point - number. - - - The radix of the number (R) is 2 ^ 24. - - - E: The exponent of the number. - - - D[0]: The sign (-1, 1) or 0 if the value is 0. In the latter case, the - values of the remaining members of the structure are ignored. - - - D[1] - D[p]: The mantissa of the number where: - - 0 <= D[i] < R and - P is the precision of the number and 1 <= p <= 32 - - D[p+1] ... D[39] have no significance. - - - The value of the number is: - - D[1] * R ^ (E - 1) + D[2] * R ^ (E - 2) ... D[p] * R ^ (E - p) - - */ -typedef struct -{ - int e; - mantissa_t d[40]; -} mp_no; - -typedef union -{ - int i[2]; - double d; -} number; - -extern const mp_no __mpone; -extern const mp_no __mptwo; - -#define X x->d -#define Y y->d -#define Z z->d -#define EX x->e -#define EY y->e -#define EZ z->e - -#ifndef RADIXI -# define RADIXI 0x1.0p-24 /* 2^-24 */ -#endif - -#ifndef TWO52 -# define TWO52 0x1.0p52 /* 2^52 */ -#endif - -#define TWO5 TWOPOW (5) /* 2^5 */ -#define TWO8 TWOPOW (8) /* 2^52 */ -#define TWO10 TWOPOW (10) /* 2^10 */ -#define TWO18 TWOPOW (18) /* 2^18 */ -#define TWO19 TWOPOW (19) /* 2^19 */ -#define TWO23 TWOPOW (23) /* 2^23 */ - -#define HALFRAD TWO23 - -#define TWO57 0x1.0p57 /* 2^57 */ -#define TWO71 0x1.0p71 /* 2^71 */ -#define TWOM1032 0x1.0p-1032 /* 2^-1032 */ -#define TWOM1022 0x1.0p-1022 /* 2^-1022 */ - -#define HALF 0x1.0p-1 /* 1/2 */ -#define MHALF -0x1.0p-1 /* -1/2 */ - -int __acr (const mp_no *, const mp_no *, int); -void __cpy (const mp_no *, mp_no *, int); -void __mp_dbl (const mp_no *, double *, int); -void __dbl_mp (double, mp_no *, int); -void __add (const mp_no *, const mp_no *, mp_no *, int); -void __sub (const mp_no *, const mp_no *, mp_no *, int); -void __mul (const mp_no *, const mp_no *, mp_no *, int); -void __sqr (const mp_no *, mp_no *, int); -void __dvd (const mp_no *, const mp_no *, mp_no *, int); - -extern void __mpatan (mp_no *, mp_no *, int); -extern void __mpatan2 (mp_no *, mp_no *, mp_no *, int); -extern void __mpsqrt (mp_no *, mp_no *, int); -extern void __c32 (mp_no *, mp_no *, mp_no *, int); -extern int __mpranred (double, mp_no *, int); diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c deleted file mode 100644 index aed4354bacd8ca569a4e1eab6fc9330cb75f74db..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mpa.c +++ /dev/null @@ -1,913 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/************************************************************************/ -/* MODULE_NAME: mpa.c */ -/* */ -/* FUNCTIONS: */ -/* mcr */ -/* acr */ -/* cpy */ -/* norm */ -/* denorm */ -/* mp_dbl */ -/* dbl_mp */ -/* add_magnitudes */ -/* sub_magnitudes */ -/* add */ -/* sub */ -/* mul */ -/* inv */ -/* dvd */ -/* */ -/* Arithmetic functions for multiple precision numbers. */ -/* Relative errors are bounded */ -/************************************************************************/ - - -#include "endian.h" -#include "mpa.h" -#include -#include - -#ifndef SECTION -# define SECTION -#endif - -#ifndef NO__CONST -const mp_no __mpone = { 1, { 1.0, 1.0 } }; -const mp_no __mptwo = { 1, { 1.0, 2.0 } }; -#endif - -#ifndef NO___ACR -/* Compare mantissa of two multiple precision numbers regardless of the sign - and exponent of the numbers. */ -static int -mcr (const mp_no *x, const mp_no *y, int p) -{ - long i; - long p2 = p; - for (i = 1; i <= p2; i++) - { - if (X[i] == Y[i]) - continue; - else if (X[i] > Y[i]) - return 1; - else - return -1; - } - return 0; -} - -/* Compare the absolute values of two multiple precision numbers. */ -int -__acr (const mp_no *x, const mp_no *y, int p) -{ - long i; - - if (X[0] == 0) - { - if (Y[0] == 0) - i = 0; - else - i = -1; - } - else if (Y[0] == 0) - i = 1; - else - { - if (EX > EY) - i = 1; - else if (EX < EY) - i = -1; - else - i = mcr (x, y, p); - } - - return i; -} -#endif - -#ifndef NO___CPY -/* Copy multiple precision number X into Y. They could be the same - number. */ -void -__cpy (const mp_no *x, mp_no *y, int p) -{ - long i; - - EY = EX; - for (i = 0; i <= p; i++) - Y[i] = X[i]; -} -#endif - -#ifndef NO___MP_DBL -/* Convert a multiple precision number *X into a double precision - number *Y, normalized case (|x| >= 2**(-1022))). X has precision - P, which is positive. */ -static void -norm (const mp_no *x, double *y, int p) -{ -# define R RADIXI - long i; - double c; - mantissa_t a, u, v, z[5]; - if (p < 5) - { - if (p == 1) - c = X[1]; - else if (p == 2) - c = X[1] + R * X[2]; - else if (p == 3) - c = X[1] + R * (X[2] + R * X[3]); - else /* p == 4. */ - c = (X[1] + R * X[2]) + R * R * (X[3] + R * X[4]); - } - else - { - for (a = 1, z[1] = X[1]; z[1] < TWO23; ) - { - a *= 2; - z[1] *= 2; - } - - for (i = 2; i < 5; i++) - { - mantissa_store_t d, r; - d = X[i] * (mantissa_store_t) a; - DIV_RADIX (d, r); - z[i] = r; - z[i - 1] += d; - } - - u = ALIGN_DOWN_TO (z[3], TWO19); - v = z[3] - u; - - if (v == TWO18) - { - if (z[4] == 0) - { - for (i = 5; i <= p; i++) - { - if (X[i] == 0) - continue; - else - { - z[3] += 1; - break; - } - } - } - else - z[3] += 1; - } - - c = (z[1] + R * (z[2] + R * z[3])) / a; - } - - c *= X[0]; - - for (i = 1; i < EX; i++) - c *= RADIX; - for (i = 1; i > EX; i--) - c *= RADIXI; - - *y = c; -# undef R -} - -/* Convert a multiple precision number *X into a double precision - number *Y, Denormal case (|x| < 2**(-1022))). */ -static void -denorm (const mp_no *x, double *y, int p) -{ - long i, k; - long p2 = p; - double c; - mantissa_t u, z[5]; - -# define R RADIXI - if (EX < -44 || (EX == -44 && X[1] < TWO5)) - { - *y = 0; - return; - } - - if (p2 == 1) - { - if (EX == -42) - { - z[1] = X[1] + TWO10; - z[2] = 0; - z[3] = 0; - k = 3; - } - else if (EX == -43) - { - z[1] = TWO10; - z[2] = X[1]; - z[3] = 0; - k = 2; - } - else - { - z[1] = TWO10; - z[2] = 0; - z[3] = X[1]; - k = 1; - } - } - else if (p2 == 2) - { - if (EX == -42) - { - z[1] = X[1] + TWO10; - z[2] = X[2]; - z[3] = 0; - k = 3; - } - else if (EX == -43) - { - z[1] = TWO10; - z[2] = X[1]; - z[3] = X[2]; - k = 2; - } - else - { - z[1] = TWO10; - z[2] = 0; - z[3] = X[1]; - k = 1; - } - } - else - { - if (EX == -42) - { - z[1] = X[1] + TWO10; - z[2] = X[2]; - k = 3; - } - else if (EX == -43) - { - z[1] = TWO10; - z[2] = X[1]; - k = 2; - } - else - { - z[1] = TWO10; - z[2] = 0; - k = 1; - } - z[3] = X[k]; - } - - u = ALIGN_DOWN_TO (z[3], TWO5); - - if (u == z[3]) - { - for (i = k + 1; i <= p2; i++) - { - if (X[i] == 0) - continue; - else - { - z[3] += 1; - break; - } - } - } - - c = X[0] * ((z[1] + R * (z[2] + R * z[3])) - TWO10); - - *y = c * TWOM1032; -# undef R -} - -/* Convert multiple precision number *X into double precision number *Y. The - result is correctly rounded to the nearest/even. */ -void -__mp_dbl (const mp_no *x, double *y, int p) -{ - if (X[0] == 0) - { - *y = 0; - return; - } - - if (__glibc_likely (EX > -42 || (EX == -42 && X[1] >= TWO10))) - norm (x, y, p); - else - denorm (x, y, p); -} -#endif - -/* Get the multiple precision equivalent of X into *Y. If the precision is too - small, the result is truncated. */ -void -SECTION -__dbl_mp (double x, mp_no *y, int p) -{ - long i, n; - long p2 = p; - - /* Sign. */ - if (x == 0) - { - Y[0] = 0; - return; - } - else if (x > 0) - Y[0] = 1; - else - { - Y[0] = -1; - x = -x; - } - - /* Exponent. */ - for (EY = 1; x >= RADIX; EY += 1) - x *= RADIXI; - for (; x < 1; EY -= 1) - x *= RADIX; - - /* Digits. */ - n = MIN (p2, 4); - for (i = 1; i <= n; i++) - { - INTEGER_OF (x, Y[i]); - x *= RADIX; - } - for (; i <= p2; i++) - Y[i] = 0; -} - -/* Add magnitudes of *X and *Y assuming that abs (*X) >= abs (*Y) > 0. The - sign of the sum *Z is not changed. X and Y may overlap but not X and Z or - Y and Z. No guard digit is used. The result equals the exact sum, - truncated. */ -static void -SECTION -add_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p) -{ - long i, j, k; - long p2 = p; - mantissa_t zk; - - EZ = EX; - - i = p2; - j = p2 + EY - EX; - k = p2 + 1; - - if (__glibc_unlikely (j < 1)) - { - __cpy (x, z, p); - return; - } - - zk = 0; - - for (; j > 0; i--, j--) - { - zk += X[i] + Y[j]; - if (zk >= RADIX) - { - Z[k--] = zk - RADIX; - zk = 1; - } - else - { - Z[k--] = zk; - zk = 0; - } - } - - for (; i > 0; i--) - { - zk += X[i]; - if (zk >= RADIX) - { - Z[k--] = zk - RADIX; - zk = 1; - } - else - { - Z[k--] = zk; - zk = 0; - } - } - - if (zk == 0) - { - for (i = 1; i <= p2; i++) - Z[i] = Z[i + 1]; - } - else - { - Z[1] = zk; - EZ += 1; - } -} - -/* Subtract the magnitudes of *X and *Y assuming that abs (*x) > abs (*y) > 0. - The sign of the difference *Z is not changed. X and Y may overlap but not X - and Z or Y and Z. One guard digit is used. The error is less than one - ULP. */ -static void -SECTION -sub_magnitudes (const mp_no *x, const mp_no *y, mp_no *z, int p) -{ - long i, j, k; - long p2 = p; - mantissa_t zk; - - EZ = EX; - i = p2; - j = p2 + EY - EX; - k = p2; - - /* Y is too small compared to X, copy X over to the result. */ - if (__glibc_unlikely (j < 1)) - { - __cpy (x, z, p); - return; - } - - /* The relevant least significant digit in Y is non-zero, so we factor it in - to enhance accuracy. */ - if (j < p2 && Y[j + 1] > 0) - { - Z[k + 1] = RADIX - Y[j + 1]; - zk = -1; - } - else - zk = Z[k + 1] = 0; - - /* Subtract and borrow. */ - for (; j > 0; i--, j--) - { - zk += (X[i] - Y[j]); - if (zk < 0) - { - Z[k--] = zk + RADIX; - zk = -1; - } - else - { - Z[k--] = zk; - zk = 0; - } - } - - /* We're done with digits from Y, so it's just digits in X. */ - for (; i > 0; i--) - { - zk += X[i]; - if (zk < 0) - { - Z[k--] = zk + RADIX; - zk = -1; - } - else - { - Z[k--] = zk; - zk = 0; - } - } - - /* Normalize. */ - for (i = 1; Z[i] == 0; i++) - ; - EZ = EZ - i + 1; - for (k = 1; i <= p2 + 1; ) - Z[k++] = Z[i++]; - for (; k <= p2; ) - Z[k++] = 0; -} - -/* Add *X and *Y and store the result in *Z. X and Y may overlap, but not X - and Z or Y and Z. One guard digit is used. The error is less than one - ULP. */ -void -SECTION -__add (const mp_no *x, const mp_no *y, mp_no *z, int p) -{ - int n; - - if (X[0] == 0) - { - __cpy (y, z, p); - return; - } - else if (Y[0] == 0) - { - __cpy (x, z, p); - return; - } - - if (X[0] == Y[0]) - { - if (__acr (x, y, p) > 0) - { - add_magnitudes (x, y, z, p); - Z[0] = X[0]; - } - else - { - add_magnitudes (y, x, z, p); - Z[0] = Y[0]; - } - } - else - { - if ((n = __acr (x, y, p)) == 1) - { - sub_magnitudes (x, y, z, p); - Z[0] = X[0]; - } - else if (n == -1) - { - sub_magnitudes (y, x, z, p); - Z[0] = Y[0]; - } - else - Z[0] = 0; - } -} - -/* Subtract *Y from *X and return the result in *Z. X and Y may overlap but - not X and Z or Y and Z. One guard digit is used. The error is less than - one ULP. */ -void -SECTION -__sub (const mp_no *x, const mp_no *y, mp_no *z, int p) -{ - int n; - - if (X[0] == 0) - { - __cpy (y, z, p); - Z[0] = -Z[0]; - return; - } - else if (Y[0] == 0) - { - __cpy (x, z, p); - return; - } - - if (X[0] != Y[0]) - { - if (__acr (x, y, p) > 0) - { - add_magnitudes (x, y, z, p); - Z[0] = X[0]; - } - else - { - add_magnitudes (y, x, z, p); - Z[0] = -Y[0]; - } - } - else - { - if ((n = __acr (x, y, p)) == 1) - { - sub_magnitudes (x, y, z, p); - Z[0] = X[0]; - } - else if (n == -1) - { - sub_magnitudes (y, x, z, p); - Z[0] = -Y[0]; - } - else - Z[0] = 0; - } -} - -#ifndef NO__MUL -/* Multiply *X and *Y and store result in *Z. X and Y may overlap but not X - and Z or Y and Z. For P in [1, 2, 3], the exact result is truncated to P - digits. In case P > 3 the error is bounded by 1.001 ULP. */ -void -SECTION -__mul (const mp_no *x, const mp_no *y, mp_no *z, int p) -{ - long i, j, k, ip, ip2; - long p2 = p; - mantissa_store_t zk; - const mp_no *a; - mantissa_store_t *diag; - - /* Is z=0? */ - if (__glibc_unlikely (X[0] * Y[0] == 0)) - { - Z[0] = 0; - return; - } - - /* We need not iterate through all X's and Y's since it's pointless to - multiply zeroes. Here, both are zero... */ - for (ip2 = p2; ip2 > 0; ip2--) - if (X[ip2] != 0 || Y[ip2] != 0) - break; - - a = X[ip2] != 0 ? y : x; - - /* ... and here, at least one of them is still zero. */ - for (ip = ip2; ip > 0; ip--) - if (a->d[ip] != 0) - break; - - /* The product looks like this for p = 3 (as an example): - - - a1 a2 a3 - x b1 b2 b3 - ----------------------------- - a1*b3 a2*b3 a3*b3 - a1*b2 a2*b2 a3*b2 - a1*b1 a2*b1 a3*b1 - - So our K needs to ideally be P*2, but we're limiting ourselves to P + 3 - for P >= 3. We compute the above digits in two parts; the last P-1 - digits and then the first P digits. The last P-1 digits are a sum of - products of the input digits from P to P-k where K is 0 for the least - significant digit and increases as we go towards the left. The product - term is of the form X[k]*X[P-k] as can be seen in the above example. - - The first P digits are also a sum of products with the same product term, - except that the sum is from 1 to k. This is also evident from the above - example. - - Another thing that becomes evident is that only the most significant - ip+ip2 digits of the result are non-zero, where ip and ip2 are the - 'internal precision' of the input numbers, i.e. digits after ip and ip2 - are all 0. */ - - k = (__glibc_unlikely (p2 < 3)) ? p2 + p2 : p2 + 3; - - while (k > ip + ip2 + 1) - Z[k--] = 0; - - zk = 0; - - /* Precompute sums of diagonal elements so that we can directly use them - later. See the next comment to know we why need them. */ - diag = alloca (k * sizeof (mantissa_store_t)); - mantissa_store_t d = 0; - for (i = 1; i <= ip; i++) - { - d += X[i] * (mantissa_store_t) Y[i]; - diag[i] = d; - } - while (i < k) - diag[i++] = d; - - while (k > p2) - { - long lim = k / 2; - - if (k % 2 == 0) - /* We want to add this only once, but since we subtract it in the sum - of products above, we add twice. */ - zk += 2 * X[lim] * (mantissa_store_t) Y[lim]; - - for (i = k - p2, j = p2; i < j; i++, j--) - zk += (X[i] + X[j]) * (mantissa_store_t) (Y[i] + Y[j]); - - zk -= diag[k - 1]; - - DIV_RADIX (zk, Z[k]); - k--; - } - - /* The real deal. Mantissa digit Z[k] is the sum of all X[i] * Y[j] where i - goes from 1 -> k - 1 and j goes the same range in reverse. To reduce the - number of multiplications, we halve the range and if k is an even number, - add the diagonal element X[k/2]Y[k/2]. Through the half range, we compute - X[i] * Y[j] as (X[i] + X[j]) * (Y[i] + Y[j]) - X[i] * Y[i] - X[j] * Y[j]. - - This reduction tells us that we're summing two things, the first term - through the half range and the negative of the sum of the product of all - terms of X and Y in the full range. i.e. - - SUM(X[i] * Y[i]) for k terms. This is precalculated above for each k in - a single loop so that it completes in O(n) time and can hence be directly - used in the loop below. */ - while (k > 1) - { - long lim = k / 2; - - if (k % 2 == 0) - /* We want to add this only once, but since we subtract it in the sum - of products above, we add twice. */ - zk += 2 * X[lim] * (mantissa_store_t) Y[lim]; - - for (i = 1, j = k - 1; i < j; i++, j--) - zk += (X[i] + X[j]) * (mantissa_store_t) (Y[i] + Y[j]); - - zk -= diag[k - 1]; - - DIV_RADIX (zk, Z[k]); - k--; - } - Z[k] = zk; - - /* Get the exponent sum into an intermediate variable. This is a subtle - optimization, where given enough registers, all operations on the exponent - happen in registers and the result is written out only once into EZ. */ - int e = EX + EY; - - /* Is there a carry beyond the most significant digit? */ - if (__glibc_unlikely (Z[1] == 0)) - { - for (i = 1; i <= p2; i++) - Z[i] = Z[i + 1]; - e--; - } - - EZ = e; - Z[0] = X[0] * Y[0]; -} -#endif - -#ifndef NO__SQR -/* Square *X and store result in *Y. X and Y may not overlap. For P in - [1, 2, 3], the exact result is truncated to P digits. In case P > 3 the - error is bounded by 1.001 ULP. This is a faster special case of - multiplication. */ -void -SECTION -__sqr (const mp_no *x, mp_no *y, int p) -{ - long i, j, k, ip; - mantissa_store_t yk; - - /* Is z=0? */ - if (__glibc_unlikely (X[0] == 0)) - { - Y[0] = 0; - return; - } - - /* We need not iterate through all X's since it's pointless to - multiply zeroes. */ - for (ip = p; ip > 0; ip--) - if (X[ip] != 0) - break; - - k = (__glibc_unlikely (p < 3)) ? p + p : p + 3; - - while (k > 2 * ip + 1) - Y[k--] = 0; - - yk = 0; - - while (k > p) - { - mantissa_store_t yk2 = 0; - long lim = k / 2; - - if (k % 2 == 0) - yk += X[lim] * (mantissa_store_t) X[lim]; - - /* In __mul, this loop (and the one within the next while loop) run - between a range to calculate the mantissa as follows: - - Z[k] = X[k] * Y[n] + X[k+1] * Y[n-1] ... + X[n-1] * Y[k+1] - + X[n] * Y[k] - - For X == Y, we can get away with summing halfway and doubling the - result. For cases where the range size is even, the mid-point needs - to be added separately (above). */ - for (i = k - p, j = p; i < j; i++, j--) - yk2 += X[i] * (mantissa_store_t) X[j]; - - yk += 2 * yk2; - - DIV_RADIX (yk, Y[k]); - k--; - } - - while (k > 1) - { - mantissa_store_t yk2 = 0; - long lim = k / 2; - - if (k % 2 == 0) - yk += X[lim] * (mantissa_store_t) X[lim]; - - /* Likewise for this loop. */ - for (i = 1, j = k - 1; i < j; i++, j--) - yk2 += X[i] * (mantissa_store_t) X[j]; - - yk += 2 * yk2; - - DIV_RADIX (yk, Y[k]); - k--; - } - Y[k] = yk; - - /* Squares are always positive. */ - Y[0] = 1; - - /* Get the exponent sum into an intermediate variable. This is a subtle - optimization, where given enough registers, all operations on the exponent - happen in registers and the result is written out only once into EZ. */ - int e = EX * 2; - - /* Is there a carry beyond the most significant digit? */ - if (__glibc_unlikely (Y[1] == 0)) - { - for (i = 1; i <= p; i++) - Y[i] = Y[i + 1]; - e--; - } - - EY = e; -} -#endif - -/* Invert *X and store in *Y. Relative error bound: - - For P = 2: 1.001 * R ^ (1 - P) - - For P = 3: 1.063 * R ^ (1 - P) - - For P > 3: 2.001 * R ^ (1 - P) - - *X = 0 is not permissible. */ -static void -SECTION -__inv (const mp_no *x, mp_no *y, int p) -{ - long i; - double t; - mp_no z, w; - static const int np1[] = - { 0, 0, 0, 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 - }; - - __cpy (x, &z, p); - z.e = 0; - __mp_dbl (&z, &t, p); - t = 1 / t; - - /* t == 0 will never happen at this point, since 1/t can only be 0 if t is - infinity, but before the division t == mantissa of x (exponent is 0). We - can instruct the compiler to ignore this case. */ - if (t == 0) - __builtin_unreachable (); - - __dbl_mp (t, y, p); - EY -= EX; - - for (i = 0; i < np1[p]; i++) - { - __cpy (y, &w, p); - __mul (x, &w, y, p); - __sub (&__mptwo, y, &z, p); - __mul (&w, &z, y, p); - } -} - -/* Divide *X by *Y and store result in *Z. X and Y may overlap but not X and Z - or Y and Z. Relative error bound: - - For P = 2: 2.001 * R ^ (1 - P) - - For P = 3: 2.063 * R ^ (1 - P) - - For P > 3: 3.001 * R ^ (1 - P) - - *X = 0 is not permissible. */ -void -SECTION -__dvd (const mp_no *x, const mp_no *y, mp_no *z, int p) -{ - mp_no w; - - if (X[0] == 0) - Z[0] = 0; - else - { - __inv (y, &w, p); - __mul (x, &w, z, p); - } -} diff --git a/sysdeps/ieee754/dbl-64/mpatan.h b/sysdeps/ieee754/dbl-64/mpatan.h deleted file mode 100644 index 0c8fd24c2cbf8f0fb503cb2bcb86f1198f92502c..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mpatan.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * Written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ - -/******************************************************************/ -/* */ -/* MODULE_NAME:mpatan.h */ -/* */ -/* common data and variables prototype and definition */ -/******************************************************************/ - -#ifndef MPATAN_H -#define MPATAN_H - -extern const number __atan_xm[8] attribute_hidden; -extern const number __atan_twonm1[33] attribute_hidden; -extern const number __atan_twom[8] attribute_hidden; -extern const int __atan_np[33] attribute_hidden; - - -#ifndef AVOID_MPATAN_H -#ifdef BIG_ENDI - const number - __atan_xm[8] = { /* x[m] */ -/**/ {{0x00000000, 0x00000000} }, /* 0.0 */ -/**/ {{0x3f8930be, 0x00000000} }, /* 0.0123 */ -/**/ {{0x3f991687, 0x00000000} }, /* 0.0245 */ -/**/ {{0x3fa923a2, 0x00000000} }, /* 0.0491 */ -/**/ {{0x3fb930be, 0x00000000} }, /* 0.0984 */ -/**/ {{0x3fc95810, 0x00000000} }, /* 0.198 */ -/**/ {{0x3fda7ef9, 0x00000000} }, /* 0.414 */ -/**/ {{0x3ff00000, 0x00000000} }, /* 1.0 */ - }; - const number - __atan_twonm1[33] = { /* 2n-1 */ -/**/ {{0x00000000, 0x00000000} }, /* 0 */ -/**/ {{0x00000000, 0x00000000} }, /* 0 */ -/**/ {{0x00000000, 0x00000000} }, /* 0 */ -/**/ {{0x00000000, 0x00000000} }, /* 0 */ -/**/ {{0x40260000, 0x00000000} }, /* 11 */ -/**/ {{0x402e0000, 0x00000000} }, /* 15 */ -/**/ {{0x40330000, 0x00000000} }, /* 19 */ -/**/ {{0x40350000, 0x00000000} }, /* 21 */ -/**/ {{0x40390000, 0x00000000} }, /* 25 */ -/**/ {{0x403d0000, 0x00000000} }, /* 29 */ -/**/ {{0x40408000, 0x00000000} }, /* 33 */ -/**/ {{0x40428000, 0x00000000} }, /* 37 */ -/**/ {{0x40448000, 0x00000000} }, /* 41 */ -/**/ {{0x40468000, 0x00000000} }, /* 45 */ -/**/ {{0x40488000, 0x00000000} }, /* 49 */ -/**/ {{0x404a8000, 0x00000000} }, /* 53 */ -/**/ {{0x404b8000, 0x00000000} }, /* 55 */ -/**/ {{0x404d8000, 0x00000000} }, /* 59 */ -/**/ {{0x404f8000, 0x00000000} }, /* 63 */ -/**/ {{0x4050c000, 0x00000000} }, /* 67 */ -/**/ {{0x4051c000, 0x00000000} }, /* 71 */ -/**/ {{0x4052c000, 0x00000000} }, /* 75 */ -/**/ {{0x4053c000, 0x00000000} }, /* 79 */ -/**/ {{0x4054c000, 0x00000000} }, /* 83 */ -/**/ {{0x40554000, 0x00000000} }, /* 85 */ -/**/ {{0x40564000, 0x00000000} }, /* 89 */ -/**/ {{0x40574000, 0x00000000} }, /* 93 */ -/**/ {{0x40584000, 0x00000000} }, /* 97 */ -/**/ {{0x40594000, 0x00000000} }, /* 101 */ -/**/ {{0x405a4000, 0x00000000} }, /* 105 */ -/**/ {{0x405b4000, 0x00000000} }, /* 109 */ -/**/ {{0x405c4000, 0x00000000} }, /* 113 */ -/**/ {{0x405d4000, 0x00000000} }, /* 117 */ - }; - -#else -#ifdef LITTLE_ENDI - - const number - __atan_xm[8] = { /* x[m] */ -/**/ {{0x00000000, 0x00000000} }, /* 0.0 */ -/**/ {{0x00000000, 0x3f8930be} }, /* 0.0123 */ -/**/ {{0x00000000, 0x3f991687} }, /* 0.0245 */ -/**/ {{0x00000000, 0x3fa923a2} }, /* 0.0491 */ -/**/ {{0x00000000, 0x3fb930be} }, /* 0.0984 */ -/**/ {{0x00000000, 0x3fc95810} }, /* 0.198 */ -/**/ {{0x00000000, 0x3fda7ef9} }, /* 0.414 */ -/**/ {{0x00000000, 0x3ff00000} }, /* 1.0 */ - }; - const number -__atan_twonm1[33] = { /* 2n-1 */ -/**/ {{0x00000000, 0x00000000} }, /* 0 */ -/**/ {{0x00000000, 0x00000000} }, /* 0 */ -/**/ {{0x00000000, 0x00000000} }, /* 0 */ -/**/ {{0x00000000, 0x00000000} }, /* 0 */ -/**/ {{0x00000000, 0x40260000} }, /* 11 */ -/**/ {{0x00000000, 0x402e0000} }, /* 15 */ -/**/ {{0x00000000, 0x40330000} }, /* 19 */ -/**/ {{0x00000000, 0x40350000} }, /* 21 */ -/**/ {{0x00000000, 0x40390000} }, /* 25 */ -/**/ {{0x00000000, 0x403d0000} }, /* 29 */ -/**/ {{0x00000000, 0x40408000} }, /* 33 */ -/**/ {{0x00000000, 0x40428000} }, /* 37 */ -/**/ {{0x00000000, 0x40448000} }, /* 41 */ -/**/ {{0x00000000, 0x40468000} }, /* 45 */ -/**/ {{0x00000000, 0x40488000} }, /* 49 */ -/**/ {{0x00000000, 0x404a8000} }, /* 53 */ -/**/ {{0x00000000, 0x404b8000} }, /* 55 */ -/**/ {{0x00000000, 0x404d8000} }, /* 59 */ -/**/ {{0x00000000, 0x404f8000} }, /* 63 */ -/**/ {{0x00000000, 0x4050c000} }, /* 67 */ -/**/ {{0x00000000, 0x4051c000} }, /* 71 */ -/**/ {{0x00000000, 0x4052c000} }, /* 75 */ -/**/ {{0x00000000, 0x4053c000} }, /* 79 */ -/**/ {{0x00000000, 0x4054c000} }, /* 83 */ -/**/ {{0x00000000, 0x40554000} }, /* 85 */ -/**/ {{0x00000000, 0x40564000} }, /* 89 */ -/**/ {{0x00000000, 0x40574000} }, /* 93 */ -/**/ {{0x00000000, 0x40584000} }, /* 97 */ -/**/ {{0x00000000, 0x40594000} }, /* 101 */ -/**/ {{0x00000000, 0x405a4000} }, /* 105 */ -/**/ {{0x00000000, 0x405b4000} }, /* 109 */ -/**/ {{0x00000000, 0x405c4000} }, /* 113 */ -/**/ {{0x00000000, 0x405d4000} }, /* 117 */ - }; - -#endif -#endif - - const int - __atan_np[33] = { 0, 0, 0, 0, 6, 8,10,11,13,15,17,19,21,23,25,27,28, - 30,32,34,36,38,40,42,43,45,47,49,51,53,55,57,59}; - -#endif -#endif diff --git a/sysdeps/ieee754/dbl-64/mpatan.c b/sysdeps/ieee754/dbl-64/mpatan.c deleted file mode 100644 index 97a16673d1a9072a3d3f43494035198a343a260e..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mpatan.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/******************************************************************/ -/* */ -/* MODULE_NAME:mpatan.c */ -/* */ -/* FUNCTIONS:mpatan */ -/* */ -/* FILES NEEDED: mpa.h endian.h mpatan.h */ -/* mpa.c */ -/* */ -/* Multi-Precision Atan function subroutine, for precision p >= 4.*/ -/* The relative error of the result is bounded by 34.32*r**(1-p), */ -/* where r=2**24. */ -/******************************************************************/ - -#include "endian.h" -#include "mpa.h" -#include - -#ifndef SECTION -# define SECTION -#endif - -#include "mpatan.h" - -void -SECTION -__mpatan (mp_no *x, mp_no *y, int p) -{ - int i, m, n; - double dx; - mp_no mptwoim1 = - { - 0, - { - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 - } - }; - - mp_no mps, mpsm, mpt, mpt1, mpt2, mpt3; - - /* Choose m and initiate mptwoim1. */ - if (EX > 0) - m = 7; - else if (EX < 0) - m = 0; - else - { - __mp_dbl (x, &dx, p); - dx = fabs (dx); - for (m = 6; m > 0; m--) - { - if (dx > __atan_xm[m].d) - break; - } - } - mptwoim1.e = 1; - mptwoim1.d[0] = 1; - - /* Reduce x m times. */ - __sqr (x, &mpsm, p); - if (m == 0) - __cpy (x, &mps, p); - else - { - for (i = 0; i < m; i++) - { - __add (&__mpone, &mpsm, &mpt1, p); - __mpsqrt (&mpt1, &mpt2, p); - __add (&mpt2, &mpt2, &mpt1, p); - __add (&__mptwo, &mpsm, &mpt2, p); - __add (&mpt1, &mpt2, &mpt3, p); - __dvd (&mpsm, &mpt3, &mpt1, p); - __cpy (&mpt1, &mpsm, p); - } - __mpsqrt (&mpsm, &mps, p); - mps.d[0] = X[0]; - } - - /* Evaluate a truncated power series for Atan(s). */ - n = __atan_np[p]; - mptwoim1.d[1] = __atan_twonm1[p].d; - __dvd (&mpsm, &mptwoim1, &mpt, p); - for (i = n - 1; i > 1; i--) - { - mptwoim1.d[1] -= 2; - __dvd (&mpsm, &mptwoim1, &mpt1, p); - __mul (&mpsm, &mpt, &mpt2, p); - __sub (&mpt1, &mpt2, &mpt, p); - } - __mul (&mps, &mpt, &mpt1, p); - __sub (&mps, &mpt1, &mpt, p); - - /* Compute Atan(x). */ - mptwoim1.d[1] = 1 << m; - __mul (&mptwoim1, &mpt, y, p); -} diff --git a/sysdeps/ieee754/dbl-64/mpatan2.c b/sysdeps/ieee754/dbl-64/mpatan2.c deleted file mode 100644 index 1ccc02ef8a876eab340b95f37b1921f668b9ba56..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mpatan2.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/******************************************************************/ -/* MODULE_NAME: mpatan2.c */ -/* */ -/* FUNCTIONS:mpatan2 */ -/* */ -/* FILES NEEDED: mpa.h */ -/* mpa.c mpatan.c mpsqrt.c */ -/* */ -/* Multi-Precision Atan2(y,x) function subroutine, */ -/* for precision p >= 4. */ -/* y=0 is not permitted if x<=0. No error messages are given. */ -/* The relative error of the result is bounded by 44.84*r**(1-p) */ -/* if x <= 0, y != 0 and by 37.33*r**(1-p) if x>0. here r=2**24. */ -/* */ -/******************************************************************/ - -#include "mpa.h" - -#ifndef SECTION -# define SECTION -#endif - -/* Multi-Precision Atan2 (y, x) function subroutine, for p >= 4. - y = 0 is not permitted if x <= 0. No error messages are given. */ -void -SECTION -__mpatan2 (mp_no *y, mp_no *x, mp_no *z, int p) -{ - mp_no mpt1, mpt2, mpt3; - - if (X[0] <= 0) - { - __dvd (x, y, &mpt1, p); - __mul (&mpt1, &mpt1, &mpt2, p); - if (mpt1.d[0] != 0) - mpt1.d[0] = 1; - __add (&mpt2, &__mpone, &mpt3, p); - __mpsqrt (&mpt3, &mpt2, p); - __add (&mpt1, &mpt2, &mpt3, p); - mpt3.d[0] = Y[0]; - __mpatan (&mpt3, &mpt1, p); - __add (&mpt1, &mpt1, z, p); - } - else - { - __dvd (y, x, &mpt1, p); - __mpatan (&mpt1, z, p); - } -} diff --git a/sysdeps/ieee754/dbl-64/mpsqrt.h b/sysdeps/ieee754/dbl-64/mpsqrt.h deleted file mode 100644 index 0e7d12b3b3eac98f71755b4bba5d76ac3f14990e..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mpsqrt.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * Written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ - -/******************************************************************/ -/* */ -/* MODULE_NAME:mpatan.h */ -/* */ -/* common data and variables prototype and definition */ -/******************************************************************/ - -#ifndef MPSQRT_H -#define MPSQRT_H - -extern const int __mpsqrt_mp[33] attribute_hidden; - - -#ifndef AVOID_MPSQRT_H - const int __mpsqrt_mp[33] = {0,0,0,0,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4}; -#endif - -#endif diff --git a/sysdeps/ieee754/dbl-64/mpsqrt.c b/sysdeps/ieee754/dbl-64/mpsqrt.c deleted file mode 100644 index 7a5b3544538fb8cfacf90a2362197cc86b7e0569..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mpsqrt.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/****************************************************************************/ -/* MODULE_NAME:mpsqrt.c */ -/* */ -/* FUNCTION:mpsqrt */ -/* fastiroot */ -/* */ -/* FILES NEEDED:endian.h mpa.h mpsqrt.h */ -/* mpa.c */ -/* Multi-Precision square root function subroutine for precision p >= 4. */ -/* The relative error is bounded by 3.501*r**(1-p), where r=2**24. */ -/* */ -/****************************************************************************/ -#include "endian.h" -#include "mpa.h" - -#ifndef SECTION -# define SECTION -#endif - -#include "mpsqrt.h" - -/****************************************************************************/ -/* Multi-Precision square root function subroutine for precision p >= 4. */ -/* The relative error is bounded by 3.501*r**(1-p), where r=2**24. */ -/* Routine receives two pointers to Multi Precision numbers: */ -/* x (left argument) and y (next argument). Routine also receives precision */ -/* p as integer. Routine computes sqrt(*x) and stores result in *y */ -/****************************************************************************/ - -static double fastiroot (double); - -void -SECTION -__mpsqrt (mp_no *x, mp_no *y, int p) -{ - int i, m, ey; - double dx, dy; - static const mp_no mphalf = {0, {1.0, HALFRAD}}; - static const mp_no mp3halfs = {1, {1.0, 1.0, HALFRAD}}; - mp_no mpxn, mpz, mpu, mpt1, mpt2; - - ey = EX / 2; - __cpy (x, &mpxn, p); - mpxn.e -= (ey + ey); - __mp_dbl (&mpxn, &dx, p); - dy = fastiroot (dx); - __dbl_mp (dy, &mpu, p); - __mul (&mpxn, &mphalf, &mpz, p); - - m = __mpsqrt_mp[p]; - for (i = 0; i < m; i++) - { - __sqr (&mpu, &mpt1, p); - __mul (&mpt1, &mpz, &mpt2, p); - __sub (&mp3halfs, &mpt2, &mpt1, p); - __mul (&mpu, &mpt1, &mpt2, p); - __cpy (&mpt2, &mpu, p); - } - __mul (&mpxn, &mpu, y, p); - EY += ey; -} - -/***********************************************************/ -/* Compute a double precision approximation for 1/sqrt(x) */ -/* with the relative error bounded by 2**-51. */ -/***********************************************************/ -static double -SECTION -fastiroot (double x) -{ - union - { - int i[2]; - double d; - } p, q; - double y, z, t; - int n; - static const double c0 = 0.99674, c1 = -0.53380; - static const double c2 = 0.45472, c3 = -0.21553; - - p.d = x; - p.i[HIGH_HALF] = (p.i[HIGH_HALF] & 0x3FFFFFFF) | 0x3FE00000; - q.d = x; - y = p.d; - z = y - 1.0; - n = (q.i[HIGH_HALF] - p.i[HIGH_HALF]) >> 1; - z = ((c3 * z + c2) * z + c1) * z + c0; /* 2**-7 */ - z = z * (1.5 - 0.5 * y * z * z); /* 2**-14 */ - p.d = z * (1.5 - 0.5 * y * z * z); /* 2**-28 */ - p.i[HIGH_HALF] -= n; - t = x * p.d; - return p.d * (1.5 - 0.5 * p.d * t); -} diff --git a/sysdeps/ieee754/dbl-64/mptan.c b/sysdeps/ieee754/dbl-64/mptan.c deleted file mode 100644 index 79fe1b3578046ffb8ba612795c85768a3c87a35d..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/mptan.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/**********************************************************************/ -/* MODULE_NAME:mptan.c */ -/* */ -/* FUNCTION: mptan */ -/* */ -/* FILES NEEDED: endian.h mpa.h */ -/* mpa.c sincos32.c branred.c */ -/* */ -/* Multi-Precision tan() function subroutine, for p=32. It is based */ -/* on the routines mpranred() and c32(). mpranred() performs range */ -/* reduction of a double number x into a multiple precision number */ -/* y, such that y=x-n*pi/2, abs(y)d[0] *= -1; - } - /* tan is negative in this area. */ - else - __dvd (&mps, &mpc, mpy, p); -} diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c index 64f81912a125e6382061d0853a8e1b12109128ff..e8f9965b18e89d08bf264810793598adaa93145b 100644 --- a/sysdeps/ieee754/dbl-64/s_sin.c +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -38,7 +38,6 @@ #include "endian.h" #include "mydefs.h" #include "usncs.h" -#include "MathLib.h" #include #include #include diff --git a/sysdeps/ieee754/dbl-64/sincos32.h b/sysdeps/ieee754/dbl-64/sincos32.h deleted file mode 100644 index 1fd33c3c448441ad1b5e21b9da6b68cb227af20a..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/sincos32.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * Written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ - -/******************************************************************/ -/* */ -/* MODULE_NAME:sincos32.h */ -/* */ -/* common data and variables prototype and definition */ -/******************************************************************/ - -#ifndef SINCOS32_H -#define SINCOS32_H - -#ifdef BIG_ENDI -static const number -/**/ hpinv = {{0x3FE45F30, 0x6DC9C883}}, /* 0.63661977236758138 */ -/**/ toint = {{0x43380000, 0x00000000}}; /* 6755399441055744 */ - -#else -#ifdef LITTLE_ENDI -static const number -/**/ hpinv = {{0x6DC9C883, 0x3FE45F30}}, /* 0.63661977236758138 */ -/**/ toint = {{0x00000000, 0x43380000}}; /* 6755399441055744 */ - -#endif -#endif - -static const mp_no - oofac27 = {-3,{1.0,7.0,4631664.0,12006312.0,13118056.0,6538613.0,646354.0, - 8508025.0,9131256.0,7548776.0,2529842.0,8864927.0,660489.0,15595125.0,12777885.0, - 11618489.0,13348664.0,5486686.0,514518.0,11275535.0,4727621.0,3575562.0, - 13579710.0,5829745.0,7531862.0,9507898.0,6915060.0,4079264.0,1907586.0, - 6078398.0,13789314.0,5504104.0,14136.0}}, - pi = {1,{1.0,3.0, - 2375530.0,8947107.0,578323.0,1673774.0,225395.0,4498441.0,3678761.0, - 10432976.0,536314.0,10021966.0,7113029.0,2630118.0,3723283.0,7847508.0, - 6737716.0,15273068.0,12626985.0,12044668.0,5299519.0,8705461.0,11880201.0, - 1544726.0,14014857.0,7994139.0,13709579.0,10918111.0,11906095.0,16610011.0, - 13638367.0,12040417.0,11529578.0,2522774.0}}, - hp = {1,{1.0, 1.0, - 9576373.0,4473553.0,8677769.0,9225495.0,112697.0,10637828.0, - 10227988.0,13605096.0,268157.0,5010983.0,3556514.0,9703667.0, - 1861641.0,12312362.0,3368858.0,7636534.0,6313492.0,14410942.0, - 2649759.0,12741338.0,14328708.0,9160971.0,7007428.0,12385677.0, - 15243397.0,13847663.0,14341655.0,16693613.0,15207791.0,14408816.0, - 14153397.0,1261387.0,6110792.0,2291862.0,4181138.0,5295267.0}}; - -static const double toverp[75] = { - 10680707.0, 7228996.0, 1387004.0, 2578385.0, 16069853.0, - 12639074.0, 9804092.0, 4427841.0, 16666979.0, 11263675.0, - 12935607.0, 2387514.0, 4345298.0, 14681673.0, 3074569.0, - 13734428.0, 16653803.0, 1880361.0, 10960616.0, 8533493.0, - 3062596.0, 8710556.0, 7349940.0, 6258241.0, 3772886.0, - 3769171.0, 3798172.0, 8675211.0, 12450088.0, 3874808.0, - 9961438.0, 366607.0, 15675153.0, 9132554.0, 7151469.0, - 3571407.0, 2607881.0, 12013382.0, 4155038.0, 6285869.0, - 7677882.0, 13102053.0, 15825725.0, 473591.0, 9065106.0, - 15363067.0, 6271263.0, 9264392.0, 5636912.0, 4652155.0, - 7056368.0, 13614112.0, 10155062.0, 1944035.0, 9527646.0, - 15080200.0, 6658437.0, 6231200.0, 6832269.0, 16767104.0, - 5075751.0, 3212806.0, 1398474.0, 7579849.0, 6349435.0, - 12618859.0, 4703257.0, 12806093.0, 14477321.0, 2786137.0, - 12875403.0, 9837734.0, 14528324.0, 13719321.0, 343717.0 }; - -#endif diff --git a/sysdeps/ieee754/dbl-64/sincos32.c b/sysdeps/ieee754/dbl-64/sincos32.c deleted file mode 100644 index a28932dffef7f7648ba2ed6d670157c34b4282b4..0000000000000000000000000000000000000000 --- a/sysdeps/ieee754/dbl-64/sincos32.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2020 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, see . - */ -/****************************************************************/ -/* MODULE_NAME: sincos32.c */ -/* */ -/* FUNCTIONS: ss32 */ -/* cc32 */ -/* c32 */ -/* sin32 */ -/* cos32 */ -/* mpsin */ -/* mpcos */ -/* mpranred */ -/* mpsin1 */ -/* mpcos1 */ -/* */ -/* FILES NEEDED: endian.h mpa.h sincos32.h */ -/* mpa.c */ -/* */ -/* Multi Precision sin() and cos() function with p=32 for sin()*/ -/* cos() arcsin() and arccos() routines */ -/* In addition mpranred() routine performs range reduction of */ -/* a double number x into multi precision number y, */ -/* such that y=x-n*pi/2, abs(y) -#include -#include - -#ifndef SECTION -# define SECTION -#endif - -/* Compute Multi-Precision sin() function for given p. Receive Multi Precision - number x and result stored at y. */ -static void -SECTION -ss32 (mp_no *x, mp_no *y, int p) -{ - int i; - double a; - mp_no mpt1, x2, gor, sum, mpk = {1, {1.0}}; - for (i = 1; i <= p; i++) - mpk.d[i] = 0; - - __sqr (x, &x2, p); - __cpy (&oofac27, &gor, p); - __cpy (&gor, &sum, p); - for (a = 27.0; a > 1.0; a -= 2.0) - { - mpk.d[1] = a * (a - 1.0); - __mul (&gor, &mpk, &mpt1, p); - __cpy (&mpt1, &gor, p); - __mul (&x2, &sum, &mpt1, p); - __sub (&gor, &mpt1, &sum, p); - } - __mul (x, &sum, y, p); -} - -/* Compute Multi-Precision cos() function for given p. Receive Multi Precision - number x and result stored at y. */ -static void -SECTION -cc32 (mp_no *x, mp_no *y, int p) -{ - int i; - double a; - mp_no mpt1, x2, gor, sum, mpk = {1, {1.0}}; - for (i = 1; i <= p; i++) - mpk.d[i] = 0; - - __sqr (x, &x2, p); - mpk.d[1] = 27.0; - __mul (&oofac27, &mpk, &gor, p); - __cpy (&gor, &sum, p); - for (a = 26.0; a > 2.0; a -= 2.0) - { - mpk.d[1] = a * (a - 1.0); - __mul (&gor, &mpk, &mpt1, p); - __cpy (&mpt1, &gor, p); - __mul (&x2, &sum, &mpt1, p); - __sub (&gor, &mpt1, &sum, p); - } - __mul (&x2, &sum, y, p); -} - -/* Compute both sin(x), cos(x) as Multi precision numbers. */ -void -SECTION -__c32 (mp_no *x, mp_no *y, mp_no *z, int p) -{ - mp_no u, t, t1, t2, c, s; - int i; - __cpy (x, &u, p); - u.e = u.e - 1; - cc32 (&u, &c, p); - ss32 (&u, &s, p); - for (i = 0; i < 24; i++) - { - __mul (&c, &s, &t, p); - __sub (&s, &t, &t1, p); - __add (&t1, &t1, &s, p); - __sub (&__mptwo, &c, &t1, p); - __mul (&t1, &c, &t2, p); - __add (&t2, &t2, &c, p); - } - __sub (&__mpone, &c, y, p); - __cpy (&s, z, p); -} - -/* Compute sin() of double-length number (X + DX) as Multi Precision number and - return result as double. If REDUCE_RANGE is true, X is assumed to be the - original input and DX is ignored. */ -double -SECTION -__mpsin (double x, double dx, bool reduce_range) -{ - double y; - mp_no a, b, c, s; - int n; - int p = 32; - - if (reduce_range) - { - n = __mpranred (x, &a, p); /* n is 0, 1, 2 or 3. */ - __c32 (&a, &c, &s, p); - } - else - { - n = -1; - __dbl_mp (x, &b, p); - __dbl_mp (dx, &c, p); - __add (&b, &c, &a, p); - if (x > 0.8) - { - __sub (&hp, &a, &b, p); - __c32 (&b, &s, &c, p); - } - else - __c32 (&a, &c, &s, p); /* b = sin(x+dx) */ - } - - /* Convert result based on which quarter of unit circle y is in. */ - switch (n) - { - case 1: - __mp_dbl (&c, &y, p); - break; - - case 3: - __mp_dbl (&c, &y, p); - y = -y; - break; - - case 2: - __mp_dbl (&s, &y, p); - y = -y; - break; - - /* Quadrant not set, so the result must be sin (X + DX), which is also in - S. */ - case 0: - default: - __mp_dbl (&s, &y, p); - } - LIBC_PROBE (slowsin, 3, &x, &dx, &y); - return y; -} - -/* Compute cos() of double-length number (X + DX) as Multi Precision number and - return result as double. If REDUCE_RANGE is true, X is assumed to be the - original input and DX is ignored. */ -double -SECTION -__mpcos (double x, double dx, bool reduce_range) -{ - double y; - mp_no a, b, c, s; - int n; - int p = 32; - - if (reduce_range) - { - n = __mpranred (x, &a, p); /* n is 0, 1, 2 or 3. */ - __c32 (&a, &c, &s, p); - } - else - { - n = -1; - __dbl_mp (x, &b, p); - __dbl_mp (dx, &c, p); - __add (&b, &c, &a, p); - if (x > 0.8) - { - __sub (&hp, &a, &b, p); - __c32 (&b, &s, &c, p); - } - else - __c32 (&a, &c, &s, p); /* a = cos(x+dx) */ - } - - /* Convert result based on which quarter of unit circle y is in. */ - switch (n) - { - case 1: - __mp_dbl (&s, &y, p); - y = -y; - break; - - case 3: - __mp_dbl (&s, &y, p); - break; - - case 2: - __mp_dbl (&c, &y, p); - y = -y; - break; - - /* Quadrant not set, so the result must be cos (X + DX), which is also - stored in C. */ - case 0: - default: - __mp_dbl (&c, &y, p); - } - LIBC_PROBE (slowcos, 3, &x, &dx, &y); - return y; -} - -/* Perform range reduction of a double number x into multi precision number y, - such that y = x - n * pi / 2, abs (y) < pi / 4, n = 0, +-1, +-2, ... - Return int which indicates in which quarter of circle x is. */ -int -SECTION -__mpranred (double x, mp_no *y, int p) -{ - number v; - double t, xn; - int i, k, n; - mp_no a, b, c; - - if (fabs (x) < 2.8e14) - { - t = (x * hpinv.d + toint.d); - xn = t - toint.d; - v.d = t; - n = v.i[LOW_HALF] & 3; - __dbl_mp (xn, &a, p); - __mul (&a, &hp, &b, p); - __dbl_mp (x, &c, p); - __sub (&c, &b, y, p); - return n; - } - else - { - /* If x is very big more precision required. */ - __dbl_mp (x, &a, p); - a.d[0] = 1.0; - k = a.e - 5; - if (k < 0) - k = 0; - b.e = -k; - b.d[0] = 1.0; - for (i = 0; i < p; i++) - b.d[i + 1] = toverp[i + k]; - __mul (&a, &b, &c, p); - t = c.d[c.e]; - for (i = 1; i <= p - c.e; i++) - c.d[i] = c.d[i + c.e]; - for (i = p + 1 - c.e; i <= p; i++) - c.d[i] = 0; - c.e = 0; - if (c.d[1] >= HALFRAD) - { - t += 1.0; - __sub (&c, &__mpone, &b, p); - __mul (&b, &hp, y, p); - } - else - __mul (&c, &hp, y, p); - n = (int) t; - if (x < 0) - { - y->d[0] = -y->d[0]; - n = -n; - } - return (n & 3); - } -} diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile index 3836574f48400eb69e3b8996103cfb3b4f4d3ea8..57892c56bb7705737ac637bed851171dd125b6bc 100644 --- a/sysdeps/x86_64/fpu/multiarch/Makefile +++ b/sysdeps/x86_64/fpu/multiarch/Makefile @@ -9,25 +9,14 @@ libm-sysdep_routines += s_ceil-sse4_1 s_ceilf-sse4_1 s_floor-sse4_1 \ s_trunc-sse4_1 s_truncf-sse4_1 libm-sysdep_routines += e_exp-fma e_log-fma e_pow-fma s_atan-fma \ - e_asin-fma e_atan2-fma s_sin-fma s_tan-fma \ - mpa-fma \ - sincos32-fma doasin-fma dosincos-fma \ - mpatan2-fma mpatan-fma mpsqrt-fma mptan-fma + e_asin-fma e_atan2-fma s_sin-fma s_tan-fma -CFLAGS-doasin-fma.c = -mfma -mavx2 -CFLAGS-dosincos-fma.c = -mfma -mavx2 CFLAGS-e_asin-fma.c = -mfma -mavx2 CFLAGS-e_atan2-fma.c = -mfma -mavx2 CFLAGS-e_exp-fma.c = -mfma -mavx2 CFLAGS-e_log-fma.c = -mfma -mavx2 CFLAGS-e_pow-fma.c = -mfma -mavx2 -CFLAGS-mpa-fma.c = -mfma -mavx2 -CFLAGS-mpatan-fma.c = -mfma -mavx2 -CFLAGS-mpatan2-fma.c = -mfma -mavx2 -CFLAGS-mpsqrt-fma.c = -mfma -mavx2 -CFLAGS-mptan-fma.c = -mfma -mavx2 CFLAGS-s_atan-fma.c = -mfma -mavx2 -CFLAGS-sincos32-fma.c = -mfma -mavx2 CFLAGS-s_sin-fma.c = -mfma -mavx2 CFLAGS-s_tan-fma.c = -mfma -mavx2 @@ -46,36 +35,23 @@ CFLAGS-s_cosf-fma.c = -mfma -mavx2 CFLAGS-s_sincosf-fma.c = -mfma -mavx2 libm-sysdep_routines += e_exp-fma4 e_log-fma4 e_pow-fma4 s_atan-fma4 \ - e_asin-fma4 e_atan2-fma4 s_sin-fma4 s_tan-fma4 \ - mpa-fma4 \ - sincos32-fma4 doasin-fma4 dosincos-fma4 \ - mpatan2-fma4 mpatan-fma4 mpsqrt-fma4 mptan-fma4 + e_asin-fma4 e_atan2-fma4 s_sin-fma4 s_tan-fma4 -CFLAGS-doasin-fma4.c = -mfma4 -CFLAGS-dosincos-fma4.c = -mfma4 CFLAGS-e_asin-fma4.c = -mfma4 CFLAGS-e_atan2-fma4.c = -mfma4 CFLAGS-e_exp-fma4.c = -mfma4 CFLAGS-e_log-fma4.c = -mfma4 CFLAGS-e_pow-fma4.c = -mfma4 -CFLAGS-mpa-fma4.c = -mfma4 -CFLAGS-mpatan-fma4.c = -mfma4 -CFLAGS-mpatan2-fma4.c = -mfma4 -CFLAGS-mpsqrt-fma4.c = -mfma4 -CFLAGS-mptan-fma4.c = -mfma4 CFLAGS-s_atan-fma4.c = -mfma4 -CFLAGS-sincos32-fma4.c = -mfma4 CFLAGS-s_sin-fma4.c = -mfma4 CFLAGS-s_tan-fma4.c = -mfma4 libm-sysdep_routines += e_exp-avx e_log-avx s_atan-avx \ - e_atan2-avx s_sin-avx s_tan-avx \ - mpa-avx + e_atan2-avx s_sin-avx s_tan-avx CFLAGS-e_atan2-avx.c = -msse2avx -DSSE2AVX CFLAGS-e_exp-avx.c = -msse2avx -DSSE2AVX CFLAGS-e_log-avx.c = -msse2avx -DSSE2AVX -CFLAGS-mpa-avx.c = -msse2avx -DSSE2AVX CFLAGS-s_atan-avx.c = -msse2avx -DSSE2AVX CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX diff --git a/sysdeps/x86_64/fpu/multiarch/doasin-fma.c b/sysdeps/x86_64/fpu/multiarch/doasin-fma.c deleted file mode 100644 index 7a09865fcaa98bc50b5461e5aca181325de9d383..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/doasin-fma.c +++ /dev/null @@ -1,4 +0,0 @@ -#define __doasin __doasin_fma -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/doasin-fma4.c b/sysdeps/x86_64/fpu/multiarch/doasin-fma4.c deleted file mode 100644 index 53eb4194726e605af7acf7f6a6513203acbca5c8..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/doasin-fma4.c +++ /dev/null @@ -1,4 +0,0 @@ -#define __doasin __doasin_fma4 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/dosincos-fma.c b/sysdeps/x86_64/fpu/multiarch/dosincos-fma.c deleted file mode 100644 index 5744586bdbda42646686d103074e6902087e85bf..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/dosincos-fma.c +++ /dev/null @@ -1,6 +0,0 @@ -#define __docos __docos_fma -#define __dubcos __dubcos_fma -#define __dubsin __dubsin_fma -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/dosincos-fma4.c b/sysdeps/x86_64/fpu/multiarch/dosincos-fma4.c deleted file mode 100644 index 1578b2fce0be41bd396abf2da8153444f5578602..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/dosincos-fma4.c +++ /dev/null @@ -1,6 +0,0 @@ -#define __docos __docos_fma4 -#define __dubcos __dubcos_fma4 -#define __dubsin __dubsin_fma4 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpa-avx.c b/sysdeps/x86_64/fpu/multiarch/mpa-avx.c deleted file mode 100644 index 366b0b7134078e79d243502dcc23198f669cf73d..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpa-avx.c +++ /dev/null @@ -1,14 +0,0 @@ -#define __add __add_avx -#define __mul __mul_avx -#define __sqr __sqr_avx -#define __sub __sub_avx -#define __dbl_mp __dbl_mp_avx -#define __dvd __dvd_avx - -#define NO___CPY 1 -#define NO___MP_DBL 1 -#define NO___ACR 1 -#define NO__CONST 1 -#define SECTION __attribute__ ((section (".text.avx"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpa-fma.c b/sysdeps/x86_64/fpu/multiarch/mpa-fma.c deleted file mode 100644 index 177cc2517f66a593ecee4737804e4c771e77e848..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpa-fma.c +++ /dev/null @@ -1,14 +0,0 @@ -#define __add __add_fma -#define __mul __mul_fma -#define __sqr __sqr_fma -#define __sub __sub_fma -#define __dbl_mp __dbl_mp_fma -#define __dvd __dvd_fma - -#define NO___CPY 1 -#define NO___MP_DBL 1 -#define NO___ACR 1 -#define NO__CONST 1 -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpa-fma4.c b/sysdeps/x86_64/fpu/multiarch/mpa-fma4.c deleted file mode 100644 index a4a759407e48c5cf1e375b32b1f9a54ce9f08c40..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpa-fma4.c +++ /dev/null @@ -1,14 +0,0 @@ -#define __add __add_fma4 -#define __mul __mul_fma4 -#define __sqr __sqr_fma4 -#define __sub __sub_fma4 -#define __dbl_mp __dbl_mp_fma4 -#define __dvd __dvd_fma4 - -#define NO___CPY 1 -#define NO___MP_DBL 1 -#define NO___ACR 1 -#define NO__CONST 1 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpatan-fma.c b/sysdeps/x86_64/fpu/multiarch/mpatan-fma.c deleted file mode 100644 index d216f9142de1cb646cc7c0e00816a97f88fc515f..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpatan-fma.c +++ /dev/null @@ -1,10 +0,0 @@ -#define __mpatan __mpatan_fma -#define __add __add_fma -#define __dvd __dvd_fma -#define __mpsqrt __mpsqrt_fma -#define __mul __mul_fma -#define __sub __sub_fma -#define AVOID_MPATAN_H 1 -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpatan-fma4.c b/sysdeps/x86_64/fpu/multiarch/mpatan-fma4.c deleted file mode 100644 index fbd3bd49a2b40a83a12f7589e7e8b233e9dee8c3..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpatan-fma4.c +++ /dev/null @@ -1,10 +0,0 @@ -#define __mpatan __mpatan_fma4 -#define __add __add_fma4 -#define __dvd __dvd_fma4 -#define __mpsqrt __mpsqrt_fma4 -#define __mul __mul_fma4 -#define __sub __sub_fma4 -#define AVOID_MPATAN_H 1 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpatan2-fma.c b/sysdeps/x86_64/fpu/multiarch/mpatan2-fma.c deleted file mode 100644 index 98df336f79fca93aef6d8dbcb5510c064d049ef3..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpatan2-fma.c +++ /dev/null @@ -1,9 +0,0 @@ -#define __mpatan2 __mpatan2_fma -#define __add __add_fma -#define __dvd __dvd_fma -#define __mpatan __mpatan_fma -#define __mpsqrt __mpsqrt_fma -#define __mul __mul_fma -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpatan2-fma4.c b/sysdeps/x86_64/fpu/multiarch/mpatan2-fma4.c deleted file mode 100644 index e6e44d49b09f67d26507a13e4d1b55c4cb5a058b..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpatan2-fma4.c +++ /dev/null @@ -1,9 +0,0 @@ -#define __mpatan2 __mpatan2_fma4 -#define __add __add_fma4 -#define __dvd __dvd_fma4 -#define __mpatan __mpatan_fma4 -#define __mpsqrt __mpsqrt_fma4 -#define __mul __mul_fma4 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpsqrt-fma.c b/sysdeps/x86_64/fpu/multiarch/mpsqrt-fma.c deleted file mode 100644 index 44d7a23ae3332b9e4d0f3eabe115f3bf5fe099e9..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpsqrt-fma.c +++ /dev/null @@ -1,8 +0,0 @@ -#define __mpsqrt __mpsqrt_fma -#define __dbl_mp __dbl_mp_fma -#define __mul __mul_fma -#define __sub __sub_fma -#define AVOID_MPSQRT_H 1 -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mpsqrt-fma4.c b/sysdeps/x86_64/fpu/multiarch/mpsqrt-fma4.c deleted file mode 100644 index f8a1ba2d92300ce3ace02bad3bc3311230037e02..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mpsqrt-fma4.c +++ /dev/null @@ -1,8 +0,0 @@ -#define __mpsqrt __mpsqrt_fma4 -#define __dbl_mp __dbl_mp_fma4 -#define __mul __mul_fma4 -#define __sub __sub_fma4 -#define AVOID_MPSQRT_H 1 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mptan-fma.c b/sysdeps/x86_64/fpu/multiarch/mptan-fma.c deleted file mode 100644 index d1a691413c58785b56fa54be0924d42103c2dc50..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mptan-fma.c +++ /dev/null @@ -1,7 +0,0 @@ -#define __mptan __mptan_fma -#define __c32 __c32_fma -#define __dvd __dvd_fma -#define __mpranred __mpranred_fma -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/mptan-fma4.c b/sysdeps/x86_64/fpu/multiarch/mptan-fma4.c deleted file mode 100644 index fb4a9d48cae2737af89d85611d64541e286138ed..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/mptan-fma4.c +++ /dev/null @@ -1,7 +0,0 @@ -#define __mptan __mptan_fma4 -#define __c32 __c32_fma4 -#define __dvd __dvd_fma4 -#define __mpranred __mpranred_fma4 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/sincos32-fma.c b/sysdeps/x86_64/fpu/multiarch/sincos32-fma.c deleted file mode 100644 index 4152b8483535b253c6e9e75978cc0da26d13b7d7..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/sincos32-fma.c +++ /dev/null @@ -1,13 +0,0 @@ -#define __c32 __c32_fma -#define __mpsin __mpsin_fma -#define __mpsin1 __mpsin1_fma -#define __mpcos __mpcos_fma -#define __mpcos1 __mpcos1_fma -#define __mpranred __mpranred_fma -#define __add __add_fma -#define __dbl_mp __dbl_mp_fma -#define __mul __mul_fma -#define __sub __sub_fma -#define SECTION __attribute__ ((section (".text.fma"))) - -#include diff --git a/sysdeps/x86_64/fpu/multiarch/sincos32-fma4.c b/sysdeps/x86_64/fpu/multiarch/sincos32-fma4.c deleted file mode 100644 index 643eedf1381a8ca8bcfd2d83448c410870bba8cf..0000000000000000000000000000000000000000 --- a/sysdeps/x86_64/fpu/multiarch/sincos32-fma4.c +++ /dev/null @@ -1,13 +0,0 @@ -#define __c32 __c32_fma4 -#define __mpsin __mpsin_fma4 -#define __mpsin1 __mpsin1_fma4 -#define __mpcos __mpcos_fma4 -#define __mpcos1 __mpcos1_fma4 -#define __mpranred __mpranred_fma4 -#define __add __add_fma4 -#define __dbl_mp __dbl_mp_fma4 -#define __mul __mul_fma4 -#define __sub __sub_fma4 -#define SECTION __attribute__ ((section (".text.fma4"))) - -#include