From patchwork Tue Jun 4 01:35:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pietro Monteiro X-Patchwork-Id: 91455 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 908833AA9417 for ; Tue, 4 Jun 2024 01:36:35 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from wfout6-smtp.messagingengine.com (wfout6-smtp.messagingengine.com [64.147.123.149]) by sourceware.org (Postfix) with ESMTPS id 5742D39960FB for ; Tue, 4 Jun 2024 01:36:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5742D39960FB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=sociotechnical.xyz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sociotechnical.xyz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5742D39960FB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=64.147.123.149 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717464981; cv=none; b=KAwXCr5nNWaQDWbQHwn6AWwdjeOLj0rufXmnT90BFY1zPzWm5WBEEQ/PH9psnExWgueBI/nv26wwx0Lfg773yg8v6KvCBna3ZizEf6hqN+I9TMr1fy8Dh9hCqZ67816CqJaN5nS7Y+8Dw/iEIPSd5lchR0iWh+vkVYlgdWTctb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717464981; c=relaxed/simple; bh=cOWhpUGq8S/gRzVix9fVFiehHQ964FMNroCc0x1dZEs=; h=DKIM-Signature:DKIM-Signature:MIME-Version:Message-Id:Date:From: To:Subject; b=lp7JVyJvjz7w9DErbXkCv85gu1VVpKCQhGlv/X+ZE9zcozWDatQBKofoWTdjZW5rmX0OqhBLYsxquFsbVhUEWP8jJAetTz8U7Vu4KCqAh26hWrc9Ai8DhrSj6n9RC1jIGst9iRREqrqf5I2OJNHcPqQoAJit9wt3mc903O/PvGs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfout.west.internal (Postfix) with ESMTP id C69381C000BB for ; Mon, 3 Jun 2024 21:36:16 -0400 (EDT) Received: from imap44 ([10.202.2.94]) by compute2.internal (MEProxy); Mon, 03 Jun 2024 21:36:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sociotechnical.xyz; h=cc:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm2; t=1717464976; x=1717551376; bh=8Cg3iR+Z7j I+6nZ0rV4awSuwSK9I7EcI+3+WoSrYH9A=; b=EoLgfgF2oRxPiMVLN1QWtj94/T k0MN8c+W+ePmLnTKTSDkrVgaWTi2APPEII5OOxEh2mSdTAClad797TIbkGy5ez3/ fjp4/+lX13E40tEAqHtapHx+AYfR6oRiP60DXiQV9Fl8Cl2iVjs18PwTBqr5K5e6 HcNnDwBs/ZbJfaAhP0QR7OiSX1AyYVkNvTQLOEkSVYk9KnH0hRXUUDY6kbgZf/tS zas5tZyJh0aA7fW2GyQgiQ7uBUKa37pB2cf5qwKkGYerbnNryvME3Q83FHar5m00 KujW3TutuVeyrV3m2W7KvLHdJTiWQn3Bs+pu0Vz+y8hL4lVH2Nx+qbZ7z6mA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1717464976; x=1717551376; bh=8Cg3iR+Z7jI+6nZ0rV4awSuwSK9I7EcI+3+ WoSrYH9A=; b=Giueb9Eo6DqC+AEOLRsoRAIPt9ZvupZJuoDNQe38P9dRxWpzDNi +gloGaRXgITQSPRXjlQX1VtU0xHy8mLd7OiiCPvauJjrkTeOJv+xRAaAr46rufvV d+bCBWG1m/JCIEqj68NjFw3whJC3AQeR9vqe7GD/GTf/bZcBtElIO5DTD7ym3Et9 DCGMwftQbWF+otf3RwuOBd3UXH6rigISkpGiqUqW1yKTUm/uGjqWoXhAp2WqjyDY am/idKqJpAEl6VNIp5X/yUUMDqzuVCoGpNPgXJ+Q9O4J1jbkLJsEp50mn6ZeXlmK JjvQBu3aSo2c0YykF2xejKtszZF4HlPFgfw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelfedggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfeehmdenucfjughrpefofg ggkfffhffvufgtsehttdertderredtnecuhfhrohhmpedfrfhivghtrhhoucfoohhnthgv ihhrohdfuceophhivghtrhhosehsohgtihhothgvtghhnhhitggrlhdrgiihiieqnecugg ftrfgrthhtvghrnhepjefgtdekfeevgfelgeefffejveevteeiffeiuddujedvheffkeef kefhudehlefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepphhivghtrhhosehsohgtihhothgvtghhnhhitggrlhdrgiihii X-ME-Proxy: Feedback-ID: i7f494689:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 26F2E36A0074; Mon, 3 Jun 2024 21:36:16 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-491-g033e30d24-fm-20240520.001-g033e30d2 MIME-Version: 1.0 Message-Id: <0ca79433-448c-469f-880a-6b228ade4b80@app.fastmail.com> Date: Mon, 03 Jun 2024 21:35:47 -0400 From: "Pietro Monteiro" To: newlib@sourceware.org Subject: [PATCH] newlib: libm: skip "long double" complex functions if long double != double X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: newlib-bounces+patchwork=sourceware.org@sourceware.org The rest of "long double" functions aren't compiled with long double and double are not the same. Do the same for all complex functions. Signed-off-by: Pietro Monteiro --- newlib/libm/complex/cargl.c | 9 ++++----- newlib/libm/complex/catanl.c | 4 +++- newlib/libm/complex/ccoshl.c | 3 +++ newlib/libm/complex/ccosl.c | 3 +++ newlib/libm/complex/cephes_subrl.c | 6 ++++++ newlib/libm/complex/cexpl.c | 3 +++ newlib/libm/complex/clogl.c | 3 +++ newlib/libm/complex/cpowl.c | 3 +++ newlib/libm/complex/cprojl.c | 4 ++++ newlib/libm/complex/csinhl.c | 3 +++ newlib/libm/complex/csinl.c | 3 +++ newlib/libm/complex/csqrtl.c | 3 +++ newlib/libm/complex/ctanhl.c | 3 +++ newlib/libm/complex/ctanl.c | 3 +++ 14 files changed, 47 insertions(+), 6 deletions(-) diff --git a/newlib/libm/complex/cargl.c b/newlib/libm/complex/cargl.c index 790cffe8f..9560cce6e 100644 --- a/newlib/libm/complex/cargl.c +++ b/newlib/libm/complex/cargl.c @@ -7,12 +7,11 @@ #include #include +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double cargl(long double complex z) -{ - #ifdef _LDBL_EQ_DBL +{ return carg (z); - #else - return atan2l (cimagl (z), creall (z)); - #endif } +#endif diff --git a/newlib/libm/complex/catanl.c b/newlib/libm/complex/catanl.c index 13839ac73..4575623c2 100644 --- a/newlib/libm/complex/catanl.c +++ b/newlib/libm/complex/catanl.c @@ -33,6 +33,8 @@ #include #include "cephes_subrl.h" +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL #ifdef __weak_alias __weak_alias(catanl, _catanl) #endif @@ -72,4 +74,4 @@ ovrf: w = HUGE_VALL + HUGE_VALL * I; return w; } - +#endif diff --git a/newlib/libm/complex/ccoshl.c b/newlib/libm/complex/ccoshl.c index f59fadf7a..0c54fd1b3 100644 --- a/newlib/libm/complex/ccoshl.c +++ b/newlib/libm/complex/ccoshl.c @@ -32,6 +32,8 @@ #include #include +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex ccoshl(long double complex z) { @@ -43,3 +45,4 @@ ccoshl(long double complex z) w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I; return w; } +#endif diff --git a/newlib/libm/complex/ccosl.c b/newlib/libm/complex/ccosl.c index c310f4024..a7619f3ec 100644 --- a/newlib/libm/complex/ccosl.c +++ b/newlib/libm/complex/ccosl.c @@ -33,6 +33,8 @@ #include #include "cephes_subrl.h" +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex ccosl(long double complex z) { @@ -43,3 +45,4 @@ ccosl(long double complex z) w = cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I; return w; } +#endif diff --git a/newlib/libm/complex/cephes_subrl.c b/newlib/libm/complex/cephes_subrl.c index 8af11df76..1d6d1b527 100644 --- a/newlib/libm/complex/cephes_subrl.c +++ b/newlib/libm/complex/cephes_subrl.c @@ -35,6 +35,8 @@ /* calculate cosh and sinh */ +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL void _cchshl(long double x, long double *c, long double *s) { @@ -51,6 +53,7 @@ _cchshl(long double x, long double *c, long double *s) *c = e + ei; } } +#endif /* Program to subtract nearest integer multiple of PI */ @@ -85,6 +88,8 @@ _redupil(long double x) /* Taylor series expansion for cosh(2y) - cos(2x) */ +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double _ctansl(long double complex z) { @@ -126,3 +131,4 @@ _ctansl(long double complex z) } while (fabsl(t/d) > MACHEPL); return d; } +#endif diff --git a/newlib/libm/complex/cexpl.c b/newlib/libm/complex/cexpl.c index 8b56634ba..24fb40af0 100644 --- a/newlib/libm/complex/cexpl.c +++ b/newlib/libm/complex/cexpl.c @@ -32,6 +32,8 @@ #include #include +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex cexpl(long double complex z) { @@ -44,3 +46,4 @@ cexpl(long double complex z) w = r * cosl(y) + r * sinl(y) * I; return w; } +#endif diff --git a/newlib/libm/complex/clogl.c b/newlib/libm/complex/clogl.c index 3644a44fc..9befec9ba 100644 --- a/newlib/libm/complex/clogl.c +++ b/newlib/libm/complex/clogl.c @@ -32,6 +32,8 @@ #include #include +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex clogl(long double complex z) { @@ -44,3 +46,4 @@ clogl(long double complex z) w = p + rr * I; return w; } +#endif diff --git a/newlib/libm/complex/cpowl.c b/newlib/libm/complex/cpowl.c index 85c2c20f2..46dfd1386 100644 --- a/newlib/libm/complex/cpowl.c +++ b/newlib/libm/complex/cpowl.c @@ -32,6 +32,8 @@ #include #include +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex cpowl(long double complex a, long double complex z) { @@ -54,3 +56,4 @@ cpowl(long double complex a, long double complex z) w = r * cosl(theta) + (r * sinl(theta)) * I; return w; } +#endif diff --git a/newlib/libm/complex/cprojl.c b/newlib/libm/complex/cprojl.c index e71c77353..28e43ed6d 100644 --- a/newlib/libm/complex/cprojl.c +++ b/newlib/libm/complex/cprojl.c @@ -45,6 +45,9 @@ __RCSID("$NetBSD: cprojl.c,v 1.7 2014/10/10 00:48:18 christos Exp $"); * * INFINITY + I * copysign(0.0, cimag(z)) */ + +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex cprojl(long double complex z) { @@ -62,3 +65,4 @@ cprojl(long double complex z) return (w.z); } +#endif diff --git a/newlib/libm/complex/csinhl.c b/newlib/libm/complex/csinhl.c index 44ed05037..3187739a0 100644 --- a/newlib/libm/complex/csinhl.c +++ b/newlib/libm/complex/csinhl.c @@ -32,6 +32,8 @@ #include #include +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex csinhl(long double complex z) { @@ -43,3 +45,4 @@ csinhl(long double complex z) w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I; return w; } +#endif diff --git a/newlib/libm/complex/csinl.c b/newlib/libm/complex/csinl.c index 2b96c7225..2c087d5d3 100644 --- a/newlib/libm/complex/csinl.c +++ b/newlib/libm/complex/csinl.c @@ -33,6 +33,8 @@ #include #include "cephes_subrl.h" +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex csinl(long double complex z) { @@ -43,3 +45,4 @@ csinl(long double complex z) w = sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I; return w; } +#endif diff --git a/newlib/libm/complex/csqrtl.c b/newlib/libm/complex/csqrtl.c index c10a1264a..cf9adf873 100644 --- a/newlib/libm/complex/csqrtl.c +++ b/newlib/libm/complex/csqrtl.c @@ -49,6 +49,8 @@ __RCSID("$NetBSD: csqrtl.c,v 1.2 2014/10/11 00:43:51 christos Exp $"); #define cpackl(r, i) ((r) + (i) * I) +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex csqrtl(long double complex z) { @@ -110,3 +112,4 @@ csqrtl(long double complex z) else return (result); } +#endif diff --git a/newlib/libm/complex/ctanhl.c b/newlib/libm/complex/ctanhl.c index 1db886f63..bbc47467b 100644 --- a/newlib/libm/complex/ctanhl.c +++ b/newlib/libm/complex/ctanhl.c @@ -32,6 +32,8 @@ #include #include +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex ctanhl(long double complex z) { @@ -45,3 +47,4 @@ ctanhl(long double complex z) return w; } +#endif diff --git a/newlib/libm/complex/ctanl.c b/newlib/libm/complex/ctanl.c index c5c887c74..9c09ca3cd 100644 --- a/newlib/libm/complex/ctanl.c +++ b/newlib/libm/complex/ctanl.c @@ -34,6 +34,8 @@ #include #include "cephes_subrl.h" +/* On platforms where long double is as wide as double. */ +#ifdef _LDBL_EQ_DBL long double complex ctanl(long double complex z) { @@ -54,3 +56,4 @@ ctanl(long double complex z) w = sinl(2.0L * creall(z)) / d + (sinhl(2.0L * cimagl(z)) / d) * I; return w; } +#endif