From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 37940b3: min and max now return one of their arguments Date: Wed, 8 Mar 2017 14:04:54 -0800 Organization: UCLA Computer Science Department Message-ID: <3530106c-241e-c7e5-f01a-7462b98db737@cs.ucla.edu> References: <20170307012700.3354.30219@vcs0.savannah.gnu.org> <20170307012701.1C05D23F1F@vcs0.savannah.gnu.org> <83efy7hih9.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------82F5CEADD63690D76FCE5277" X-Trace: blaine.gmane.org 1489010744 17007 195.159.176.226 (8 Mar 2017 22:05:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 8 Mar 2017 22:05:44 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 08 23:05:40 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cljiC-0003gt-9H for ged-emacs-devel@m.gmane.org; Wed, 08 Mar 2017 23:05:37 +0100 Original-Received: from localhost ([::1]:58690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cljiI-00039p-8i for ged-emacs-devel@m.gmane.org; Wed, 08 Mar 2017 17:05:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cljhj-00038b-Fz for emacs-devel@gnu.org; Wed, 08 Mar 2017 17:05:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cljhf-00012p-GH for emacs-devel@gnu.org; Wed, 08 Mar 2017 17:05:07 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48014) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cljhZ-0000v9-Qr; Wed, 08 Mar 2017 17:04:58 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4F67F16007A; Wed, 8 Mar 2017 14:04:56 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id QKmkdE_j22O2; Wed, 8 Mar 2017 14:04:55 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D568C16007C; Wed, 8 Mar 2017 14:04:54 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LRUAKhrkHvYa; Wed, 8 Mar 2017 14:04:54 -0800 (PST) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id BCFF716007A; Wed, 8 Mar 2017 14:04:54 -0800 (PST) In-Reply-To: <83efy7hih9.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212851 Archived-At: This is a multi-part message in MIME format. --------------82F5CEADD63690D76FCE5277 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 03/08/2017 07:54 AM, Eli Zaretskii wrote: > Don't programmers > assume in general that comparisons between values some of which are > floats are always done after converting_all_ values to the > floating-point representation? No, and that hasn't been true for Emacs Lisp for quite some time. In Emacs 25, (<= 10000000000000001 10000000000000000 1e16) returns the mathematically-correct answer nil on a 64-bit GNU/Linux host even though it would return t if all values were first converted to float. More generally, although people expect statically typed languages to convert alternatives to float (e.g., C programmers expect (1.5 > 2 ? 1.5 : 2) to return 2.0 not 2), dynamically typed languages are different: Lisp programmers expect (if (> 1.5 2) 1.5 2) to return 2 not 2.0. Admittedly the situation with min and max is not quite as simple as with 'if' (which clearly should not convert). Still, it's verrrry strange for (< A (min A B)) to return t, and having 'min' return the numerically correct answer avoids nonsensical behavior like that. > I find the commentary in 'arithcompare' not detailed enough I installed the attached, which I hope helps. --------------82F5CEADD63690D76FCE5277 Content-Type: application/x-patch; name="0001-src-data.c-arithcompare-Add-comments.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-src-data.c-arithcompare-Add-comments.patch" RnJvbSAzYzUwYjVkNjAwZjBlMTU5ZDIxZjlkOTRlOWM0NzNjYzJmZjczMzAzIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBXZWQsIDggTWFyIDIwMTcgMTM6NDM6MTYgLTA4MDAKU3ViamVjdDogW1BBVENI XSAqIHNyYy9kYXRhLmMgKGFyaXRoY29tcGFyZSk6IEFkZCBjb21tZW50cy4KCi0tLQogc3Jj L2RhdGEuYyB8IDIyICsrKysrKysrKysrKysrKysrKy0tLS0KIDEgZmlsZSBjaGFuZ2VkLCAx OCBpbnNlcnRpb25zKCspLCA0IGRlbGV0aW9ucygtKQoKZGlmZi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