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: Tue, 7 Mar 2017 22:08:39 -0800 Organization: UCLA Computer Science Department Message-ID: References: <20170307012700.3354.30219@vcs0.savannah.gnu.org> <20170307012701.1C05D23F1F@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1488953334 27042 195.159.176.226 (8 Mar 2017 06:08:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 8 Mar 2017 06:08:54 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 08 07:08:50 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 1clUmH-0006Hd-55 for ged-emacs-devel@m.gmane.org; Wed, 08 Mar 2017 07:08:49 +0100 Original-Received: from localhost ([::1]:54250 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clUmL-0002Zz-B1 for ged-emacs-devel@m.gmane.org; Wed, 08 Mar 2017 01:08:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clUmE-0002Zp-Me for emacs-devel@gnu.org; Wed, 08 Mar 2017 01:08:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clUmB-0004Tc-H7 for emacs-devel@gnu.org; Wed, 08 Mar 2017 01:08:46 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:34840) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clUmB-0004TE-BT for emacs-devel@gnu.org; Wed, 08 Mar 2017 01:08:43 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A13D2160064; Tue, 7 Mar 2017 22:08:40 -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 4ODe-iwZQ894; Tue, 7 Mar 2017 22:08:39 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E272C16007A; Tue, 7 Mar 2017 22:08:39 -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 dV7Z7TTgL__j; Tue, 7 Mar 2017 22:08:39 -0800 (PST) Original-Received: from [192.168.1.9] (unknown [47.153.188.248]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C25C8160064; Tue, 7 Mar 2017 22:08:39 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:212831 Archived-At: Stefan Monnier wrote: > I'm wondering what is the motivation for this change. It avoids nonsensical behavior where 'min' and 'max' were inconsistent wi= th '<'=20 and '>'. Before the patch, (max A B) could return A even when (< A B) ret= urned=20 t. For example: (let* ((a 1e16) (b (1+ (floor a)))) (list a b (max a b) (< a b) (if (< a b) b a))) returned (1e+16 10000000000000001 1e+16 t 10000000000000001) on a 64-bit=20 GNU/Linux host just before the patch was applied. In this example, '<' is= =20 behaving correctly since A is less than B, and 'max' is behaving incorrec= tly=20 since it is returning the lesser of A and B. (Come to think of it, this e= xample=20 is clearer than what's in etc/NEWS, so I'll update etc/NEWS.) In the old days Emacs could assume that every Emacs integer had an exact=20 floating-point representation, so it was OK for functions like '<' and 'm= ax' to=20 convert integer arguments to floating-point before doing their comparison= s since=20 these conversions could not lose information. This is no longer true, and= the=20 low-level code now needs to be more careful when comparing fixnums to flo= ats.