From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: Floating-point constant folding in Emacs byte compiler Date: Fri, 23 Mar 2018 20:52:52 +0000 Message-ID: References: <2ce39e5c-cd1b-65d6-b125-719caad67932@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1521838307 8696 195.159.176.226 (23 Mar 2018 20:51:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Mar 2018 20:51:47 +0000 (UTC) Cc: Emacs development discussions To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 23 21:51:42 2018 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 1ezTf4-0002BD-BO for ged-emacs-devel@m.gmane.org; Fri, 23 Mar 2018 21:51:42 +0100 Original-Received: from localhost ([::1]:39784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezTh7-0000C2-Ng for ged-emacs-devel@m.gmane.org; Fri, 23 Mar 2018 16:53:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezTgt-0008VR-QD for emacs-devel@gnu.org; Fri, 23 Mar 2018 16:53:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezTgt-0005ld-60 for emacs-devel@gnu.org; Fri, 23 Mar 2018 16:53:35 -0400 Original-Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:39612) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezTgs-0005ib-V4 for emacs-devel@gnu.org; Fri, 23 Mar 2018 16:53:35 -0400 Original-Received: by mail-wm0-x236.google.com with SMTP id f125so5750109wme.4 for ; Fri, 23 Mar 2018 13:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=cFN91LcGRgZN6Kzr344ejIC8fVWIdzQ+uvbzm1QqDQY=; b=FUWe8gXbPxQojWco6ab8i9q39giyuWV673AXKNgtQZTZf8DxjjGIb/LVv8oo9SwhB9 3mDTvs53ZmWknE+al6UWQ2Y1P2PUOZJdzpGTU4XAB9wAQ1xg9+A+/c8+yFSvPT6U/oqE tW2+6/Xne0eeJbB0w96mHBUeQlSTV1TvFJSzDA4aAig1NQB0fsKS+L+u3iqTFXrNK8Mh tzgunjMWMuNcPG6vdN33fvi094yug/JZAHDEKtrFD6lRlZu17N3pKRNgPxTCpxgymO4N PVBrMyf28MgZ1Lo/5UAh1hY+AeFZglaBnjN4sooKzreWRIzK4P1L3cu85nvwx6ON/YCX 8j9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=cFN91LcGRgZN6Kzr344ejIC8fVWIdzQ+uvbzm1QqDQY=; b=l1fYqJFRIYYiTMSZ+2NgVD9hNckj8sSzQc/9zuwU9r5CItq4sOSnpvnXJO5L+uOi+M H7JzGGxHu82vZOo+FVXxpO26FjUh5CUXmNEwG6GB6FjNu+8A31G0sXqd6ZXARpWWzPAl s6Izz1XMzpB0bxe6Ns+T0R/XcvmN9X06v9p2NHoSYVv6wO1sRFZkQ1g0hjmR8p6M4LL2 MOuFFUoFaZZEbGpkfvZ2CRbplafkS+znpd+FpwxWAX2LvKcjYouuib1sciuTZeI6dJtn 3Fhzsoc4WwHUkP8o64kD4aDH4oKq5pg32NfALXOEVgBlXWY0G6fS4SlMJdxnJlzaUaEg eTKA== X-Gm-Message-State: AElRT7EfYHegNkRrgJ/Iml3gfVl8abyxQ3vuJeesrunQTWvzPt9at8ad wnQnP03yt6VzW5xOaCgyN+iiokjGVCWoVcJE3IY= X-Google-Smtp-Source: AG47ELv82smOJl37FZl4cpveKnL7ztgMTB4D5o2JrRxW6pcElAxoRBczK7gYFyCS5d7ghuft0KNyg/OV9XinbAfjYIU= X-Received: by 10.80.179.74 with SMTP id r10mr29794153edd.228.1521838412516; Fri, 23 Mar 2018 13:53:32 -0700 (PDT) Original-Received: by 10.80.129.230 with HTTP; Fri, 23 Mar 2018 13:52:52 -0700 (PDT) In-Reply-To: <2ce39e5c-cd1b-65d6-b125-719caad67932@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::236 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:223977 Archived-At: Is this really specific to floating-point expressions, though? (byte-compile (lambda (x) (* #x10000 #x10000 #x10000 #x10000))) #[(x) "=C3=80\207" [0] 1] (at least on this somewhat oudated version of Emacs). Note the 0 in the constant vector, which hardcodes the <65-bit-ness of fixnums. I imagine that on a 32-bit version of emacs, (byte-compile (lambda (x) (* #x10000 #x10000))) similarly produces a constant-zero function, which will produce the wrong result when fixnums are actually 62 bits long. (This is tangential, but I think that it might make sense, at some point in the future, to switch to JavaScript-like everything-is-a-float-but-there's-just-one-NaN "numbers"; that would be quite a bit of work already, since several functions do different things for integer and float arguments (I feel they should be fixed anyway), and it would be nice to be able to point to the current byte-opt situation as evidence that if you're relying on unusual number behavior, you're already doing something wrong)