From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#42597: 27.1; (+ -0.0) returns +0.0 when compiled (fwd) Date: Wed, 29 Jul 2020 18:32:45 +0000 Message-ID: References: <1A998EAD-92A5-42FD-B382-33C0FE2A7D20@acm.org> Reply-To: Andrea Corallo 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="20443"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: 42597@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 29 20:33:19 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1k0qtC-0005Bu-Op for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jul 2020 20:33:18 +0200 Original-Received: from localhost ([::1]:59666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0qtB-00084O-Qj for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jul 2020 14:33:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0qsx-00083H-Rv for bug-gnu-emacs@gnu.org; Wed, 29 Jul 2020 14:33:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0qsw-0005UU-Cp for bug-gnu-emacs@gnu.org; Wed, 29 Jul 2020 14:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k0qsw-00047z-AY for bug-gnu-emacs@gnu.org; Wed, 29 Jul 2020 14:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Jul 2020 18:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42597 X-GNU-PR-Package: emacs Original-Received: via spool by 42597-submit@debbugs.gnu.org id=B42597.159604757915851 (code B ref 42597); Wed, 29 Jul 2020 18:33:02 +0000 Original-Received: (at 42597) by debbugs.gnu.org; 29 Jul 2020 18:32:59 +0000 Original-Received: from localhost ([127.0.0.1]:33711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0qsm-00047N-8Z for submit@debbugs.gnu.org; Wed, 29 Jul 2020 14:32:59 -0400 Original-Received: from mx.sdf.org ([205.166.94.24]:62272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0qsh-00047C-PX for 42597@debbugs.gnu.org; Wed, 29 Jul 2020 14:32:51 -0400 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTP id 06TIWjnx021190; Wed, 29 Jul 2020 18:32:45 GMT In-Reply-To: (Alan Mackenzie's message of "Wed, 29 Jul 2020 15:41:27 +0200 (CEST)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:183673 Archived-At: Alan Mackenzie writes: > Hello, Mattias. > > In article you wrote: >> Unary +, *, min and max, all of which should be identity for numbers, >> convert -0.0 to +0.0 when byte-compiled: > > They convert what? > >> (defun f (x) (+ x)) >> (f -0.0) >> =3D> -0.0 >> (byte-compile 'f) >> (f -0.0) >> =3D> 0.0 > >> The reason is that byte-compile-associative transforms (+ x), (* x), >> (min x) and (max x) into (+ x 0). > >> No patch yet (sorry!) but I'm not sure what would be the best way to go >> about it. Some possibilities: > >> A. Use a full 1-argument call, like (+ x). This is more expensive >> (about 1.8=C3=97) since the general function call mechanism has to be= used. >> B. Use (* x 1) instead; this appears to work. This is also more >> expensive (1.6=C3=97); not sure why. >> C. Add a new byte-op. Fast but probably overkill. > >> Better suggestions welcome! > > This is an example of what happens when ignorant people rule the roost. > -0.0 and +0.0 are identically the same thing. It should not take a > degree in mathematics (which I have) to realise this. When you put > mathematical nonsense into you cannot > help but get nonsense back out. > > 0.0 does not need two different names. It can do nothing but produce > confusion, what has clearly happened here at whatever level. > > So my suggestion D. would be: Eliminate "-0.0" from Emacs Lisp. If this > is not possible for whatever reason, then E. Do nothing. For completeness I'd like to link what is prescribed on that for CL: " Notes: =3D differs from eql in that (=3D 0.0 -0.0) is always true, because =3D compares the mathematical values of its operands, whereas eql compares the representational values, so to speak. " Andrea --=20 akrl@sdf.org