From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.devel Subject: hypotenuse (was: Re: Adding a generic mathematical library) Date: Sun, 21 Jul 2024 18:13:39 +0200 Message-ID: References: <8734o9sdig.fsf@posteo.net> <87wmllqq66.fsf@posteo.net> <87plrdqnhc.fsf@posteo.net> <87le21qldj.fsf_-_@posteo.net> <878qy1at52.fsf@dataswamp.org> <87plr6u8al.fsf_-_@dataswamp.org> <86wmleby8w.fsf@gnu.org> <86sew2bxii.fsf@gnu.org> <86plr6bvl9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13188"; mail-complaints-to="usenet@ciao.gmane.io" Cc: incal@dataswamp.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 21 18:14:17 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sVZCT-0003I9-Js for ged-emacs-devel@m.gmane-mx.org; Sun, 21 Jul 2024 18:14:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVZCJ-0003cz-AQ; Sun, 21 Jul 2024 12:14:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVZC5-0003X5-S0 for emacs-devel@gnu.org; Sun, 21 Jul 2024 12:13:56 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVZC3-0000TJ-55; Sun, 21 Jul 2024 12:13:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.com; s=s31663417; t=1721578420; x=1722183220; i=dimech@gmx.com; bh=bIw5xpVNIe4xYgXvwR5exWidnTTIjOZzSBHEXGuxl7o=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Cc:Subject: Content-Type:Date:In-Reply-To:References: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=ZaMc2hoOK1MhJsRVHwdS2LddjiJNp7qf5mOL0FRqeUTermuKtkNSOA+bmvvNcvBr EZf8C0nIcsFTMVXINcPxdycbneqJ2034GeojGyg89k+gSqTt6iUadiwPHTSPPEKGa Q64YL4CRQj8AuUl3cHd15jYPxf2L73lt7PGiKR7qvZA1q927aCg1iok/41XmeqePi YQE5JkkfW0cuy/49MFgV2KGMSAvxVPSXmW6nhbl4/ac4+uxD+QIWFX51PTvZJC3lJ kDCFwJ0cpM7VN0P3F+WJUShSQNN7CnuS5xrxkRPglJ9faZhgwT+GVdwoi0oOVxYYV OeMU2JwKYrHSr+WSRQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [92.251.79.197] ([92.251.79.197]) by web-mail.gmx.net (3c-app-mailcom-bs10.server.lan [172.19.170.178]) (via HTTP); Sun, 21 Jul 2024 18:13:39 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <86plr6bvl9.fsf@gnu.org> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:wfHO99/ikwdUqeLZQzzjSNF0rRKEPtbX8beKq22hhZ8tj7Y4ll6h1C3asl4pfLjyohEWT 08LUWGRFmClCgkqbYkD8kUPidfRA+o5VROmMP3JN4Kz8OxFbrmaW9SXWYunnFEymP8WOqxg5XhU6 hl1q7rKLhgr/rMhsKEDpcqaKSNF0mw5JkHaShkLK3ap1m0qxeHZ03qLl6g3syPsvRx7stEQULm5V 90M50ACmIPPxKwwQz0K6Hmc/Tom2HXsUXwSZ4CsKD3vf/WD+sfw7PZY0SA6peATpa46PIdvl1K/1 Mw= UI-OutboundReport: notjunk:1;M01:P0:fcUgQYwSwPY=;5EphZAIo1DiCv2XQzNo8uWoVJ9u 6o9uB5/Kpdy1kRDn78Ln3kb3OKVSeXHD7LuR3ZlDFUKzBwVYXYB4qB59nkLiiVcHu80UzSH+u DouG9bdgdeGgfdKPPGTzoz6mIYx0gHDti91Zz9738NLO+ROb5oL5Ri1e2onVuOEazOp7PMnH5 AojBeCB0Lg6jKnfFQ2EXxaUfVDXdB+sYB7nttaGbliEQfIgBardGIIsvWFJDzVSqpDwLfrshH mfVeJAtxmN/z0gzifJAqKM9X2mxmZ5O9niwnHLmczPZp7FLu+q5t/cGvS0s/DNKwzmEJ/S1ys A3hnY8g1vLaphD+H+G7alNyNaC22VT3PFlZwjU6AHse/6kfj1Jp8jSMCCgxFGoS9zEGYw5T/V ir27nHnNcyI0Vgnsgw+y3FPsan8EhSEZ/Jt16rY6SEK1Fh3UQgxJZAphqFWw2J/tIjA3OTdDy 2GpipRzrjZ3cLzMu2exZtgfDAsVu/2VxtPTBVizovgt0satM54vQAo332syD3oSvKDAIXoUyB 1UQ4cSBZrGJUb26oAqiAe+bQ0rstMuNS2xHyQF2qa/aTXtJ9BPzU/pYziEWlaCSUHaTMZHt9S LUR22KrNe9IHetkFB9gSIC7rHM4uVZbNLkedLE0dVJwQpy477kiK0/vS9mvfSTPBwd0GkClDO /sn1BUAu/E7+9yuKHa+EURiHrena2wnG4XPKcx6REw== Received-SPF: pass client-ip=212.227.15.15; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321905 Archived-At: > Sent: Monday, July 22, 2024 at 3:42 AM > From: "Eli Zaretskii" > To: "Christopher Dimech" > Cc: incal@dataswamp.org, emacs-devel@gnu.org > Subject: Re: hypotenuse (was: Re: Adding a generic mathematical library) > > > From: Christopher Dimech > > Cc: incal@dataswamp.org, emacs-devel@gnu.org > > Date: Sun, 21 Jul 2024 17:12:10 +0200 > > Sensitivity: Normal > > > > > Sent: Monday, July 22, 2024 at 3:00 AM > > > From: "Eli Zaretskii" > > > To: incal@dataswamp.org > > > Cc: emacs-devel@gnu.org > > > Subject: Re: hypotenuse (was: Re: Adding a generic mathematical libr= ary) > > > > > > > Date: Sun, 21 Jul 2024 17:44:47 +0300 > > > > From: Eli Zaretskii > > > > Cc: emacs-devel@gnu.org > > > > > > > > > (defun hypotenuse (c1 c2) > > > > > (sqrt (+ (* c1 c1) (* c2 c2))) ) > > > > > > > > This is not the best way of computing hypot: squaring a number cou= ld > > > > overflow or underflow, and you get bad result. Try > > > > > > > > (hypotenuse 1.e-600 1.e-600) > > > > or > > > > (hypotenuse 1.e600 1.e600) > > > > > > > > and you will see it. > > > > > > Sorry, that should have been 1.e-300 and 1.e300 instead. > > > > I have a solution to the problem in fortran, but not in elisp. I coul= d > > include it. Its implementation required serious concentration. > > AFAIK, every libm already includes a similar implementation, so we > should just expose it to Lisp (again, assuming this function is indeed > required to be part of Emacs). The people involved in calc do think it is required.