From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: hypotenuse (was: Re: Adding a generic mathematical library) Date: Sun, 21 Jul 2024 18:00:37 +0300 Message-ID: <86sew2bxii.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3104"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: incal@dataswamp.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 21 17:01: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 1sVY3p-0000bY-5u for ged-emacs-devel@m.gmane-mx.org; Sun, 21 Jul 2024 17:01:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVY3R-0005FD-N8; Sun, 21 Jul 2024 11:00:53 -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 1sVY3F-00059j-TF for emacs-devel@gnu.org; Sun, 21 Jul 2024 11:00:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVY3E-0002Ln-PJ; Sun, 21 Jul 2024 11:00:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6pQ20ZnS88x+XYXh3N/V8Shf5O9jr81M+LClHPenXdA=; b=XjjP1+ji1A+8 vdDX/KVWi1Xa7hnKUQWC0qCtmmxcw0Jxm+w+tE4G11mP7UcTBA/wkkGLpMktBf94uLgcXOcjQWD3z l6oOP7fkFFFbOQmQkhcgKjzqcP566NS4ZI0GTV/OOnukak9nuQjSufy4uGrI95XSzVx/PjEUjuoZS NembMcog1H3eiVqYjgclTZAeWjaAqkw7gPUDkeoILIiLsbuHFBegKGTsI+yQ+09aeGBCPQwXB84g9 GrAEyfpFP/8isA/UlyDXIzU3GZ8X8rdfmb23Y88vYxOEzb4LNut/cDbD8vdbnPbuuB3AM43ok0xRw tlNWM58W7aJwOdv4OWEPAw==; In-Reply-To: <86wmleby8w.fsf@gnu.org> (message from Eli Zaretskii on Sun, 21 Jul 2024 17:44:47 +0300) 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:321892 Archived-At: > 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 could > 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.