From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Katsumi Yamaoka Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2018 03:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153447664823010 (code B ref -1); Fri, 17 Aug 2018 03:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Aug 2018 03:30:48 +0000 Received: from localhost ([127.0.0.1]:53156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqVTL-0005z4-UD for submit@debbugs.gnu.org; Thu, 16 Aug 2018 23:30:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqVTJ-0005yo-HL for submit@debbugs.gnu.org; Thu, 16 Aug 2018 23:30:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqVTD-0006Dj-HC for submit@debbugs.gnu.org; Thu, 16 Aug 2018 23:30:40 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:49216) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqVTD-0006Dd-E0 for submit@debbugs.gnu.org; Thu, 16 Aug 2018 23:30:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqVTC-0004qM-Dn for bug-gnu-emacs@gnu.org; Thu, 16 Aug 2018 23:30:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqVT8-0006CK-Ft for bug-gnu-emacs@gnu.org; Thu, 16 Aug 2018 23:30:38 -0400 Received: from glow.birch.relay.mailchannels.net ([23.83.209.71]:62881) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqVT8-0005jf-74 for bug-gnu-emacs@gnu.org; Thu, 16 Aug 2018 23:30:34 -0400 X-Sender-Id: tih5qno0ow|x-authuser|yamaoka@hampton.hostforweb.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id EBF7C5E25BF; Fri, 17 Aug 2018 03:29:51 +0000 (UTC) Received: from hampton.hostforweb.net (unknown [100.96.26.113]) (Authenticated sender: tih5qno0ow) by relay.mailchannels.net (Postfix) with ESMTPA id 5479F5E25A2; Fri, 17 Aug 2018 03:29:51 +0000 (UTC) X-Sender-Id: tih5qno0ow|x-authuser|yamaoka@hampton.hostforweb.net Received: from hampton.hostforweb.net (hampton.hostforweb.net [172.245.115.217]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.1); Fri, 17 Aug 2018 03:29:51 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: tih5qno0ow|x-authuser|yamaoka@hampton.hostforweb.net X-MailChannels-Auth-Id: tih5qno0ow X-Grain-Drop: 7c59e1803e62ba97_1534476591798_3694048682 X-MC-Loop-Signature: 1534476591798:3882630700 X-MC-Ingress-Time: 1534476591797 Received: from s70.gtokyofl21.vectant.ne.jp ([202.215.75.70]:60000 helo=localhost) by hampton.hostforweb.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fqVSM-008urg-Sm; Thu, 16 Aug 2018 22:29:48 -0500 Date: Fri, 17 Aug 2018 12:29:45 +0900 Message-ID: From: Katsumi Yamaoka Organization: Emacsen advocacy group X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-unknown-cygwin) Cancel-Lock: sha1:KINsnAMTKxcmBDyl/OEOzVlZT6c= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-OutGoing-Spam-Status: No, score=-0.5 X-AuthUser: yamaoka@hampton.hostforweb.net X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.1 (-----) Hi, What do I have to do to get -1 by `(logior -1)' ? Otherwise, is it just a bug? Setting `binary-as-unsigned' has no effect. I'm using an old input method sj3-egg[1] but it got not to work. The following Lisp snippet shows what it does first when opening the connection to the sj3 server: (with-temp-buffer (set-buffer-multibyte nil) (let ((pt (point-min))) (insert "\377\377\377\376") (logior (lsh (- (logxor (char-after pt) 128) 128) 24) (lsh (char-after (+ pt 1)) 16) (lsh (char-after (+ pt 2)) 8) (lsh (char-after (+ pt 3)) 0)))) It should return -2, but 4611686018427387902 now. (Oh, it's doubled most-positive-fixnum!) Thanks. [1] http://www.jpl.org/ftp/pub/elisp/sj3-egg-0.8.5.tar.gz In GNU Emacs 27.0.50 (build 1, x86_64-unknown-cygwin, GTK+ Version 3.22.28) of 2018-08-17 built on localhost Windowing system distributor 'The Cygwin/X Project', version 11.0.12000000 From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2018 06:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: yamaoka@jpl.org Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15344856004994 (code B ref 32463); Fri, 17 Aug 2018 06:00:03 +0000 Received: (at 32463) by debbugs.gnu.org; 17 Aug 2018 06:00:00 +0000 Received: from localhost ([127.0.0.1]:53185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqXnj-0001IT-NJ for submit@debbugs.gnu.org; Fri, 17 Aug 2018 02:00:00 -0400 Received: from mail-lj1-f181.google.com ([209.85.208.181]:40958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqXnh-0001I5-TL for 32463@debbugs.gnu.org; Fri, 17 Aug 2018 01:59:58 -0400 Received: by mail-lj1-f181.google.com with SMTP id j19-v6so5481596ljc.7 for <32463@debbugs.gnu.org>; Thu, 16 Aug 2018 22:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bbmwjM3RTMqNKQ/nHy331A6QvGRjtYpm/2XEj49r7mw=; b=begLn9Ph3mdf5VVJy+fC/Z7mNmuwu+XuomBRiqeH4OAy0HpgBZ3ENdFjRJByr7NdJo iaYNN1EOBkmFZs2Jdy/K6U+Szf37rv2xjr9FwZF+Fqt6ijStrU6olk/jQzCElpcb50AK KMsRN1P1iTxzpUbZ4J5iRujnjsAuB1vtqBvKvU8ZEfXNKpuyKXtbRD9huMdtUj2Z7rk0 jo6AldTnuT9x7V+zRS61ODgeJXNnqf1MJtrKOcq+e/9YHNK4S4AWq46/qcNesQmBQ/Yh BP9GB9Xd8zJAEG1sIYlcnD3hg6fjvsGZOW3vk7r7LvzODq4Mt1rUYEJ4eUwBJvKH/+aj Hb+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bbmwjM3RTMqNKQ/nHy331A6QvGRjtYpm/2XEj49r7mw=; b=aB0gqpt7DGi7X7KGUak4ahODXsTDky8CnRISkw6nlzsNXjTeUyIzzPUp07hmC5h3wX /UkKHN2Zmr2N9A2qpdfTtzwAziynbdLJIOfBLEgEtCA1SDHn9p97KaGyfX1jCf1AyblG hgTMnF/OHQGicARQKFsoaVXJDGZysa1BbPUiBvQ21UnXQAROeXjd5a52rHJ8NfaXdPyK 5oTGnkkLDzx3XsCaDZ8mm2BcQ/AUl9yRUJkTqkWrUP3vzrk+FtJ4c4mq+tJsu9hvt4+R og/sFrO75kXCsINMVqxyGOsE/4IbmVCE2uuc/FsRp8bZdC3pNqDrgjlPxaKOmjqKvNNq ZJSQ== X-Gm-Message-State: AOUpUlFlGJXZa5aOmfL6RcOlbbb2Sak03JOxWlyXVQ4Ts5lY2BUtR5ip WScOoPKpYZm9sLCMhoKnY+ejlVS6S6N2XLKta0o= X-Google-Smtp-Source: AA+uWPyvX8eBokO941l7Wltn5H6EIKm0dRpFw+vXRyKo5ZwWUb+/dpWbPHuG2dOuzyd97ZX+ZlZL3HvRpzP0JTnE5sA= X-Received: by 2002:a2e:2114:: with SMTP id h20-v6mr24835066ljh.135.1534485591757; Thu, 16 Aug 2018 22:59:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Pip Cet Date: Fri, 17 Aug 2018 05:59:14 +0000 Message-ID: Content-Type: multipart/mixed; boundary="0000000000009c8fad05739b442c" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000009c8fad05739b442c Content-Type: text/plain; charset="UTF-8" Can you try the attached patch? It fixes a few things that I reported to Tom yesterday: --- None of these are necessarily bugs, but: * I find the behavior of `lsh', `logand', `logior', and `logxor', when given negative arguments, surprising. I think it would make most sense to treat negative numbers as the infinite bitstream consisting of all ones to the left of the specified value: (logand -1 -1) would be interpreted as ...1111111 & ...1111111 = ...1111111, so it would be -1 (rather than 2 * most-positive-fixnum + 1). (lsh (- (lsh -1 64) 1) -1) would be ...1110111...1111 shifted to the right by one digit, an odd number, rather than the even number currently produced. (I believe lsh and ash should behave identically.) * the documentation of `random' still refers to representable integers * I think we should rename `random' to `random-fixnum' and add a Lisp function `random' which accepts positive fixnum, bignum, and float arguments, doing the right thing for each. `cl-random' similarly needs updating, or documentation of its current 32-bit nature. * there appears to be a most-positive-bignum; on x86-64, it consists of 0x7fffffff 8-byte words of one bits, 16 GiB. Operating on integers larger than that will currently abort emacs with an error message: "gmp: overflow in mpz type". * long-running bignum operations appear not to be interruptible. Please consider something like the attached patch? Thanks! On Fri, Aug 17, 2018 at 3:31 AM Katsumi Yamaoka wrote: > > Hi, > > What do I have to do to get -1 by `(logior -1)' ? Otherwise, > is it just a bug? Setting `binary-as-unsigned' has no effect. > > I'm using an old input method sj3-egg[1] but it got not to work. > The following Lisp snippet shows what it does first when opening > the connection to the sj3 server: > > (with-temp-buffer > (set-buffer-multibyte nil) > (let ((pt (point-min))) > (insert "\377\377\377\376") > (logior > (lsh (- (logxor (char-after pt) 128) 128) 24) > (lsh (char-after (+ pt 1)) 16) > (lsh (char-after (+ pt 2)) 8) > (lsh (char-after (+ pt 3)) 0)))) > > It should return -2, but 4611686018427387902 now. > (Oh, it's doubled most-positive-fixnum!) > > Thanks. > > [1] http://www.jpl.org/ftp/pub/elisp/sj3-egg-0.8.5.tar.gz > > In GNU Emacs 27.0.50 (build 1, x86_64-unknown-cygwin, GTK+ Version 3.22.28) > of 2018-08-17 built on localhost > Windowing system distributor 'The Cygwin/X Project', version 11.0.12000000 > > > --0000000000009c8fad05739b442c Content-Type: text/x-patch; charset="US-ASCII"; name="Minor-bignum-tweaks.patch" Content-Disposition: attachment; filename="Minor-bignum-tweaks.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jkxl2b9a0 ZGlmZiAtLWdpdCBhL3NyYy9kYXRhLmMgYi9zcmMvZGF0YS5jCmluZGV4IGExMjE1YjlkNmJmLi5l YjE1YmM1YmRkYSAxMDA2NDQKLS0tIGEvc3JjL2RhdGEuYworKysgYi9zcmMvZGF0YS5jCkBAIC0z MDA2LDcgKzMwMDYsNyBAQCBhcml0aF9kcml2ZXIgKGVudW0gYXJpdGhvcCBjb2RlLCBwdHJkaWZm X3QgbmFyZ3MsIExpc3BfT2JqZWN0ICphcmdzKQogCSAgICB7CiAJICAgICAgbXB6X3QgdGVtOwog CSAgICAgIG1wel9pbml0ICh0ZW0pOwotCSAgICAgIG1wel9zZXRfdWludG1heCAodGVtLCBYVUZJ WE5VTSAodmFsKSk7CisJICAgICAgbXB6X3NldF9pbnRtYXggKHRlbSwgWEZJWE5VTSAodmFsKSk7 CiAJICAgICAgbXB6X2FuZCAoYWNjdW0sIGFjY3VtLCB0ZW0pOwogCSAgICAgIG1wel9jbGVhciAo dGVtKTsKIAkgICAgfQpAQCAtMzAxOCw3ICszMDE4LDcgQEAgYXJpdGhfZHJpdmVyIChlbnVtIGFy aXRob3AgY29kZSwgcHRyZGlmZl90IG5hcmdzLCBMaXNwX09iamVjdCAqYXJncykKIAkgICAgewog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oZXJ3aXNl IGZyb20gbGVzcy1yYW5kb20KK3ZvbGF0aWxlIGRhdGEgc3VjaCBhcyB0aGUgdGltZS4gIFdpdGgg YSBzdHJpbmcgYXJndW1lbnQsIHNldCB0aGUgc2VlZAorYmFzZWQgb24gdGhlIHN0cmluZydzIGNv bnRlbnRzLiAgT3RoZXIgdmFsdWVzIG9mIExJTUlUIGFyZSBpZ25vcmVkLgogCiBTZWUgSW5mbyBu b2RlIGAoZWxpc3ApUmFuZG9tIE51bWJlcnMnIGZvciBtb3JlIGRldGFpbHMuICAqLykKICAgKExp c3BfT2JqZWN0IGxpbWl0KQo= --0000000000009c8fad05739b442c-- From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Katsumi Yamaoka Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2018 07:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153449166816266 (code B ref 32463); Fri, 17 Aug 2018 07:42:02 +0000 Received: (at 32463) by debbugs.gnu.org; 17 Aug 2018 07:41:08 +0000 Received: from localhost ([127.0.0.1]:53223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqZNb-0004EI-PM for submit@debbugs.gnu.org; Fri, 17 Aug 2018 03:41:07 -0400 Received: from catfish.maple.relay.mailchannels.net ([23.83.214.32]:49416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqZNY-0004E7-2X for 32463@debbugs.gnu.org; Fri, 17 Aug 2018 03:41:04 -0400 X-Sender-Id: tih5qno0ow|x-authuser|yamaoka@hampton.hostforweb.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 1BED3426B0; Fri, 17 Aug 2018 07:41:01 +0000 (UTC) Received: from hampton.hostforweb.net (unknown [100.96.16.105]) (Authenticated sender: tih5qno0ow) by relay.mailchannels.net (Postfix) with ESMTPA id 73FDE427F1; Fri, 17 Aug 2018 07:41:00 +0000 (UTC) X-Sender-Id: tih5qno0ow|x-authuser|yamaoka@hampton.hostforweb.net Received: from hampton.hostforweb.net (hampton.hostforweb.net [172.245.115.217]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.1); Fri, 17 Aug 2018 07:41:01 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: tih5qno0ow|x-authuser|yamaoka@hampton.hostforweb.net X-MailChannels-Auth-Id: tih5qno0ow X-Shoe-Eyes: 25d8eaf109923e6f_1534491660925_1298882370 X-MC-Loop-Signature: 1534491660924:2543616855 X-MC-Ingress-Time: 1534491660924 Received: from s70.gtokyofl21.vectant.ne.jp ([202.215.75.70]:60000 helo=localhost) by hampton.hostforweb.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fqZNQ-00A4Ln-I5; Fri, 17 Aug 2018 02:40:57 -0500 Date: Fri, 17 Aug 2018 16:40:55 +0900 Message-ID: From: Katsumi Yamaoka References: Organization: Emacsen advocacy group X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-unknown-cygwin) Cancel-Lock: sha1:Rib77hHKjt9gIjOqwWrlBtRo4MY= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-OutGoing-Spam-Status: No, score=0.3 X-AuthUser: yamaoka@hampton.hostforweb.net X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, 17 Aug 2018 05:59:14 +0000, Pip Cet wrote: > Can you try the attached patch? It fixes a few things that I reported > to Tom yesterday: Oh, the patch solves my problem. sj3-egg now works as before. Thank you! From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2018 09:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153449840831926 (code B ref -1); Fri, 17 Aug 2018 09:34:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Aug 2018 09:33:28 +0000 Received: from localhost ([127.0.0.1]:53259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqb8J-0008Ir-Sy for submit@debbugs.gnu.org; Fri, 17 Aug 2018 05:33:28 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqb8I-0008IT-LW for submit@debbugs.gnu.org; Fri, 17 Aug 2018 05:33:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqb8B-00009p-E8 for submit@debbugs.gnu.org; Fri, 17 Aug 2018 05:33:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57326) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqb88-00007Q-Q7 for submit@debbugs.gnu.org; Fri, 17 Aug 2018 05:33:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqb83-0005f0-Gg for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 05:33:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqb2f-0004lc-W9 for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 05:27:41 -0400 Received: from [195.159.176.226] (port=35542 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fqb2f-0004kq-PJ for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 05:27:37 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fqb0W-0000Qt-7d for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 11:25:24 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Fri, 17 Aug 2018 10:27:25 +0100 Lines: 56 Message-ID: <86mutll4w2.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) Cancel-Lock: sha1:8Hu5MK0hzWw8yYWdkKxjFqZlPZc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) On Fri 17 Aug 2018, Pip Cet wrote: > Can you try the attached patch? It fixes a few things that I reported > to Tom yesterday: > > --- > > > None of these are necessarily bugs, but: > > * I find the behavior of `lsh', `logand', `logior', and `logxor', when > given negative arguments, surprising. I think it would make most sense > to treat negative numbers as the infinite bitstream consisting of all > ones to the left of the specified value: > > (logand -1 -1) would be interpreted as ...1111111 & ...1111111 = > ...1111111, so it would be -1 (rather than 2 * most-positive-fixnum + > 1). > (lsh (- (lsh -1 64) 1) -1) would be ...1110111...1111 shifted to the > right by one digit, an odd number, rather than the even number > currently produced. (I believe lsh and ash should behave identically.) > @@ -3383,8 +3383,6 @@ ash_lsh_impl (Lisp_Object value, Lisp_Object count, bool lsh) > mpz_init (result); > if (XFIXNUM (count) >= 0) > mpz_mul_2exp (result, XBIGNUM (value)->value, XFIXNUM (count)); > - else if (lsh) > - mpz_tdiv_q_2exp (result, XBIGNUM (value)->value, - XFIXNUM (count)); > else > mpz_fdiv_q_2exp (result, XBIGNUM (value)->value, - XFIXNUM (count)); > val = make_number (result); > @@ -3401,14 +3399,7 @@ ash_lsh_impl (Lisp_Object value, Lisp_Object count, bool lsh) Please add more test cases to test/src/data-tests.el to ensure that the logical operations have the expected behaviour for positive and negative arguments, and for both bignum and fixnum arguments. The tdiv/fdiv were added to give expected results. Pay particular attention to values around most-positive-fixnum and most-negative-fixnum. > if (XFIXNUM (count) >= 0) > mpz_mul_2exp (result, result, XFIXNUM (count)); > - else if (lsh) > - { > - if (mpz_sgn (result) > 0) > - mpz_fdiv_q_2exp (result, result, - XFIXNUM (count)); > - else > - mpz_fdiv_q_2exp (result, result, - XFIXNUM (count)); > - } > - else /* ash */ > + else > mpz_fdiv_q_2exp (result, result, - XFIXNUM (count)); This part is an obvious simplification and is fine (I should have spotted it before sending my patch that Tom committed). AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2018 11:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: andrewjmoreton@gmail.com, eggert@cs.ucla.edu Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153450581223728 (code B ref 32463); Fri, 17 Aug 2018 11:37:01 +0000 Received: (at 32463) by debbugs.gnu.org; 17 Aug 2018 11:36:52 +0000 Received: from localhost ([127.0.0.1]:53289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqd3j-0006Ad-KU for submit@debbugs.gnu.org; Fri, 17 Aug 2018 07:36:51 -0400 Received: from mail-lf1-f53.google.com ([209.85.167.53]:37540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqd3h-0006AR-Uz for 32463@debbugs.gnu.org; Fri, 17 Aug 2018 07:36:50 -0400 Received: by mail-lf1-f53.google.com with SMTP id j8-v6so5668101lfb.4 for <32463@debbugs.gnu.org>; Fri, 17 Aug 2018 04:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oDVvIQR2+JDaSPRT5z6il0fZMHxY4E534OQu0+Lbhrw=; b=RYjWI5BJtSH+lxNi3SNBPoR7Fq9nL5RSS9OjwiqVD6za1s2jJRPLT6GwkXBcXQ+tTO LKjFRlzN/8G1wXHwGAYKHrBfh/SWrKgzmBVbeN1PgF7oB7j8hSzRpWI5VeYaYu5x3Vfb RPJnTbTUwFeLSEEcO5nrzxPJwC4u7TRKBlzOy4a/lzwUvn89tCkpWM0mykEkQLVWXush 7sFbqokk9IaTRIh6RsYdsqAta6oZERa0OL3ynWSQIBnbVu+eiAplSb090rgcsmQPTZbU UL6rYFWuevcSocQOux6L+bofe3+Bhu8iLbkYiwcN27ZT+ZEmbJZtN1N9Y/5u+gQ/j4oT h2YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oDVvIQR2+JDaSPRT5z6il0fZMHxY4E534OQu0+Lbhrw=; b=pny7jrZIAGKqn+bDO3cQ0P+eMwJqMDSnHCGfwzXqQO5wgLdXqWyJync9tVgIf+hy0W vbGE+C1RqBeMVfFFOsnz8ufdI9JVclYIWdaCbgEbp/Sp24Tk8RV4WrX4MwVoIDkW+fqY 8smfDRLqAlScOq/Ms3qg0uhxiCkIuzlL7dlOVg/z8RO5CIgZy06KcSnY5bVUOxtJlRT6 gnDWbqbD7Ddfv9st/CZ0npwULQIVOWXJvT7W4yAosz3YaciaojzJzlmPH3zoItT1ccW5 9tTgad0QGwjcjBbjHbM9EXmsoqtFbMLWFYH89XgfJkcjo+vslMOrEGhO6f3y64a/S6FJ rbGQ== X-Gm-Message-State: AOUpUlHBy1x6E0bQLusy4XInLz9gRJFq206U2mC4hBJf1eA3W4cCkwCa isf7Oq/DUd4erjAZ4HCXz1Op3HmjU6uwIL5UVaw= X-Google-Smtp-Source: AA+uWPzQBDUlRoXqMwjhUnxSjO/xr3abySFD6+GQL/5ZwoRJ32FJgppfuaz2GeuBFzTvLkuXAVXy4zr0KZjUrww7S+4= X-Received: by 2002:a19:a5c5:: with SMTP id o188-v6mr22013547lfe.149.1534505804066; Fri, 17 Aug 2018 04:36:44 -0700 (PDT) MIME-Version: 1.0 References: <86mutll4w2.fsf@gmail.com> In-Reply-To: <86mutll4w2.fsf@gmail.com> From: Pip Cet Date: Fri, 17 Aug 2018 11:36:06 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, Aug 17, 2018 at 9:34 AM Andy Moreton wrote: > > On Fri 17 Aug 2018, Pip Cet wrote: > > > Can you try the attached patch? It fixes a few things that I reported > > to Tom yesterday: > > > > --- > > > > > > None of these are necessarily bugs, but: > > > > * I find the behavior of `lsh', `logand', `logior', and `logxor', when > > given negative arguments, surprising. I think it would make most sense > > to treat negative numbers as the infinite bitstream consisting of all > > ones to the left of the specified value: > > > > (logand -1 -1) would be interpreted as ...1111111 & ...1111111 = > > ...1111111, so it would be -1 (rather than 2 * most-positive-fixnum + > > 1). > > (lsh (- (lsh -1 64) 1) -1) would be ...1110111...1111 shifted to the > > right by one digit, an odd number, rather than the even number > > currently produced. (I believe lsh and ash should behave identically.) > > > @@ -3383,8 +3383,6 @@ ash_lsh_impl (Lisp_Object value, Lisp_Object count, bool lsh) > > mpz_init (result); > > if (XFIXNUM (count) >= 0) > > mpz_mul_2exp (result, XBIGNUM (value)->value, XFIXNUM (count)); > > - else if (lsh) > > - mpz_tdiv_q_2exp (result, XBIGNUM (value)->value, - XFIXNUM (count)); > > else > > mpz_fdiv_q_2exp (result, XBIGNUM (value)->value, - XFIXNUM (count)); > > val = make_number (result); > > @@ -3401,14 +3399,7 @@ ash_lsh_impl (Lisp_Object value, Lisp_Object count, bool lsh) > > Please add more test cases to test/src/data-tests.el to ensure that the > logical operations have the expected behaviour for positive and negative > arguments, and for both bignum and fixnum arguments. Paul committed a patch in the meantime (independently, I think?) which does add tests. I'll try to write some more. > The tdiv/fdiv were > added to give expected results. Pay particular attention to values around > most-positive-fixnum and most-negative-fixnum. I don't think they do give the expected results. We should discuss that in more detail, but first, can we agree that lsh and ash behave the same for bignums? If so, clearly one branch of the code you quoted is incorrect, and I think it's the tdiv one. I ran: (require 'cl) (let ((i 0)) (while (< i 128) (message "%d %x" i (lsh (- (lsh -1 i) 1) -1)) (incf i))) and got this output: [...] 57 -100000000000001 58 -200000000000001 59 -400000000000001 60 -800000000000001 61 -1000000000000000 62 -2000000000000000 63 -4000000000000000 64 -8000000000000000 [...] Something is wrong there. The expression certainly shouldn't switch from being odd to being even just because we're leaving the fixnum range. If I do the calculation by hand on a piece of paper, I get the results that correspond to the fixnum case, not the bignum case. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2018 11:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: andrewjmoreton@gmail.com, eggert@cs.ucla.edu Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153450687126006 (code B ref 32463); Fri, 17 Aug 2018 11:55:01 +0000 Received: (at 32463) by debbugs.gnu.org; 17 Aug 2018 11:54:31 +0000 Received: from localhost ([127.0.0.1]:53293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqdKp-0006lO-73 for submit@debbugs.gnu.org; Fri, 17 Aug 2018 07:54:31 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:32881) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqdKn-0006l0-Dy for 32463@debbugs.gnu.org; Fri, 17 Aug 2018 07:54:29 -0400 Received: by mail-lj1-f196.google.com with SMTP id s12-v6so6151794ljj.0 for <32463@debbugs.gnu.org>; Fri, 17 Aug 2018 04:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4L61F70yTP6b5+R3lgo8eeXDomlhwBVX5WQQFob7Opc=; b=JGNJpNt6B425viF5h1cwD6m1EsbDsbA1x+wPNQOn9rmJFQFn3VuqO+83DHbLHnrFzM +SRcAh22/SsKzrlD94WHWZ3tR7kHpAwnLnyI4/Tk3lQiIpzNZ6lQUNXjkAdSh5+omdiU DA+/uuUly/d/M/7L04JzwuiCBuKWuKy5t21U2q/t2whsY8xug7JBGiLA+eRpXX0sE9RP UOIYZS6lwGGL7drq6vO+8NGQpTQCMadT+1mPpDniwNmhObEfY04RsiNR8Bulywb+nMCY 8THLMOf2Cu2qZm9gF8xQABI5RPOS7UfJ0+xYKfo2Rk0KEtsotH2uas38QXgJqwjuPAjR P+5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4L61F70yTP6b5+R3lgo8eeXDomlhwBVX5WQQFob7Opc=; b=FHEgogSSCRigTI+FcNTtR2uB5RTt1d4/JhLI9n01XOSsufxMTba1rLkoCXcac790lP mYb+veXRpoeI672Wp8z/t3LAjn+Ifvsf+y9yiLbn868Q1GhxzLSZLc1EdwYAnpFlg2kR nybO45C7s3WcSxlzVBBq27vfj6Njet0JKf04984SoCaqxdtwQ/N+lSoF4pEFwD1FFUVz 7cCfz7IgU5qvRJdSncje2zCui4+quQueuBe6zt/m8cSfcfQxyun8m+Y9phwtH2XOmIkJ XWf+5nMnVfkHYTGeXW3p7ecEDysQ4TwCWu/RMNDlMd8DrAm+/G/YIhK29Fxm6AZ0u+cj ENBQ== X-Gm-Message-State: AOUpUlHYPCIf9hrrK9HlsOhtWi8EWgSvIvSPVavpL/N8CCaaWaVEi2bW AWqX2tRcfCvdg303dyXwfZHrQ5WJEev8xd4AXB8= X-Google-Smtp-Source: AA+uWPwutRO5mcDa/kFxaWdIHqh+wJZKZYPBYHqvLtGRsAiDPcV2mrDIK87zEeKkInuqWO9bmQCW3F3Nf3KobkTLEPU= X-Received: by 2002:a2e:2114:: with SMTP id h20-v6mr25804880ljh.135.1534506863642; Fri, 17 Aug 2018 04:54:23 -0700 (PDT) MIME-Version: 1.0 References: <86mutll4w2.fsf@gmail.com> In-Reply-To: From: Pip Cet Date: Fri, 17 Aug 2018 11:53:45 +0000 Message-ID: Content-Type: multipart/mixed; boundary="000000000000836b950573a0385f" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000836b950573a0385f Content-Type: text/plain; charset="UTF-8" On Fri, Aug 17, 2018 at 11:36 AM Pip Cet wrote: > and got this output: I forgot to mention this is on an x86-64 machine with a Linux kernel and Debian GNU/Linux, and external libgmp. I'm attaching the patch that I think should still be applied, which includes some tests. --000000000000836b950573a0385f Content-Type: text/x-patch; charset="US-ASCII"; name="Minor-bignum-tweaks-002.patch" Content-Disposition: attachment; filename="Minor-bignum-tweaks-002.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jkxxpynq0 ZGlmZiAtLWdpdCBhL3NyYy9kYXRhLmMgYi9zcmMvZGF0YS5jCmluZGV4IDVhMzU1ZDk3ODdjLi4w NzdjYzgyODNlYiAxMDA2NDQKLS0tIGEvc3JjL2RhdGEuYworKysgYi9zcmMvZGF0YS5jCkBAIC0z MzgyLDggKzMzODIsNiBAQCBhc2hfbHNoX2ltcGwgKExpc3BfT2JqZWN0IHZhb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QgKD0gKGFz aCAoLSAobHNoIG1vc3QtbmVnYXRpdmUtZml4bnVtIDEpIDEpIC0xKQorICAgICAgICAgICAgICgt IG1vc3QtbmVnYXRpdmUtZml4bnVtIDEpKSkpCiAKIDs7OyBkYXRhLXRlc3RzLmVsIGVuZHMgaGVy ZQo= --000000000000836b950573a0385f-- From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2018 13:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15345122662995 (code B ref -1); Fri, 17 Aug 2018 13:25:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 Aug 2018 13:24:26 +0000 Received: from localhost ([127.0.0.1]:53343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqejq-0000mF-0W for submit@debbugs.gnu.org; Fri, 17 Aug 2018 09:24:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42205) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqejp-0000m2-5y for submit@debbugs.gnu.org; Fri, 17 Aug 2018 09:24:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqejj-0005ua-Bl for submit@debbugs.gnu.org; Fri, 17 Aug 2018 09:24:19 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51963) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqejj-0005uK-7h for submit@debbugs.gnu.org; Fri, 17 Aug 2018 09:24:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqeji-0006Mv-Bs for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:24:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqeje-0005rh-Ec for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:24:18 -0400 Received: from [195.159.176.226] (port=56480 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fqeje-0005pD-7U for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:24:14 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fqehV-0001j2-Rp for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 15:22:01 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Fri, 17 Aug 2018 14:24:02 +0100 Lines: 52 Message-ID: References: <86mutll4w2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:F4Mrt4+JWcJDiiscTV8oJu0Dtlk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) On Fri 17 Aug 2018, Pip Cet wrote: > On Fri, Aug 17, 2018 at 9:34 AM Andy Moreton wrote: > Paul committed a patch in the meantime (independently, I think?) which > does add tests. I'll try to write some more. Thanks. I should have done that with my patches to fix some bignum bugs. >> The tdiv/fdiv were >> added to give expected results. Pay particular attention to values around >> most-positive-fixnum and most-negative-fixnum. > > I don't think they do give the expected results. We should discuss > that in more detail, but first, can we agree that lsh and ash behave > the same for bignums? If so, clearly one branch of the code you quoted > is incorrect, and I think it's the tdiv one. I agree that for bignums lsh and ash should behave the same way. I can easily belive that there are bugs in this code, as I was fighting problems with 64bit Windows having 32bit long at the same time. > I ran: > > (require 'cl) > > (let ((i 0)) > (while (< i 128) > (message "%d %x" i (lsh (- (lsh -1 i) 1) -1)) > (incf i))) Or equivalently: (dotimes (i 128) (message "%d %x" i (lsh (1- (lsh -1 i)) -1))) > and got this output: > > [...] > 57 -100000000000001 > 58 -200000000000001 > 59 -400000000000001 > 60 -800000000000001 > 61 -1000000000000000 > 62 -2000000000000000 > 63 -4000000000000000 > 64 -8000000000000000 > [...] > > Something is wrong there. Yes, this is clearly not behaving correctly and needs to be fixed. Thanks for investigating this. AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2018 13:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15345127543890 (code B ref -1); Fri, 17 Aug 2018 13:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Aug 2018 13:32:34 +0000 Received: from localhost ([127.0.0.1]:53348 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqerf-00010c-PR for submit@debbugs.gnu.org; Fri, 17 Aug 2018 09:32:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqere-00010N-9M for submit@debbugs.gnu.org; Fri, 17 Aug 2018 09:32:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqerY-00057t-1q for submit@debbugs.gnu.org; Fri, 17 Aug 2018 09:32:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44377) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqerX-00057j-TZ for submit@debbugs.gnu.org; Fri, 17 Aug 2018 09:32:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqerW-0004SU-RT for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:32:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqerS-00053e-TM for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:32:22 -0400 Received: from [195.159.176.226] (port=40531 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fqerS-00052v-Li for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:32:18 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fqepK-0002hi-2f for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 15:30:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Fri, 17 Aug 2018 14:27:32 +0100 Lines: 18 Message-ID: References: <86mutll4w2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:Ctkt18EeJzd13gN/VDzMTGswgZc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) On Fri 17 Aug 2018, Pip Cet wrote: > On Fri, Aug 17, 2018 at 11:36 AM Pip Cet wrote: >> and got this output: > > I forgot to mention this is on an x86-64 machine with a Linux kernel > and Debian GNU/Linux, and external libgmp. > > I'm attaching the patch that I think should still be applied, which > includes some tests. I have tried this patch on a Windows MSYS2 mingw64 x86_64 build [1], and the updated data-tests pass. Thanks for fixing the bugs I introduced. AndyM [1] This needs a patched gmp.h to avoid a different problem with incorrect DLL imports from libgmp-10.dll that break Flogcount. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 18:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet , andrewjmoreton@gmail.com Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153461810023917 (code B ref 32463); Sat, 18 Aug 2018 18:49:01 +0000 Received: (at 32463) by debbugs.gnu.org; 18 Aug 2018 18:48:20 +0000 Received: from localhost ([127.0.0.1]:54233 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr6Gq-0006Dg-1q for submit@debbugs.gnu.org; Sat, 18 Aug 2018 14:48:20 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:55626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr6Go-0006DS-Qx for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 14:48:19 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 18A07160F92; Sat, 18 Aug 2018 11:48:13 -0700 (PDT) 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 G3yIdMfdvC2t; Sat, 18 Aug 2018 11:48:12 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 54180160FBE; Sat, 18 Aug 2018 11:48:12 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 weeV1JlLy8F5; Sat, 18 Aug 2018 11:48:12 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D3392160F92; Sat, 18 Aug 2018 11:48:11 -0700 (PDT) References: <86mutll4w2.fsf@gmail.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> Date: Sat, 18 Aug 2018 11:48:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Pip Cet wrote: > Paul committed a patch in the meantime (independently, I think?) which > does add tests. I'll try to write some more. Yes, I noticed the logior etc. problem separately and fixed it in master without knowing about this bug report. There are some other bignum problems too that need fixing and are in my pipeline. > can we agree that lsh and ash behave > the same for bignums? It would be weird for lsh to act one way for negative bignums, and a different and incompatible way for negative fixnums. Instead, I suggest that we deprecate lsh, as it doesn't make sense any more now that integers have unbounded size. While we're deprecating it, we can make (lsh A B) signal an error if A is a bignum and B is negative, since there's nothing we can do there that is reasonable and is compatible with the fixnum behavior. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 19:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: andrewjmoreton@gmail.com, pipcet@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153461880925441 (code B ref 32463); Sat, 18 Aug 2018 19:01:02 +0000 Received: (at 32463) by debbugs.gnu.org; 18 Aug 2018 19:00:09 +0000 Received: from localhost ([127.0.0.1]:54242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr6SH-0006cG-Ct for submit@debbugs.gnu.org; Sat, 18 Aug 2018 15:00:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr6SF-0006as-PN for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 15:00:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fr6S5-0005dm-OQ for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 15:00:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fr6S5-0005di-Kw; Sat, 18 Aug 2018 14:59:57 -0400 Received: from [176.228.60.248] (port=4215 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fr6S5-0001rw-9O; Sat, 18 Aug 2018 14:59:57 -0400 Date: Sat, 18 Aug 2018 21:59:49 +0300 Message-Id: <83a7pjfql6.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> (message from Paul Eggert on Sat, 18 Aug 2018 11:48:11 -0700) References: <86mutll4w2.fsf@gmail.com> <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Paul Eggert > Date: Sat, 18 Aug 2018 11:48:11 -0700 > Cc: 32463@debbugs.gnu.org > > It would be weird for lsh to act one way for negative bignums, and a different > and incompatible way for negative fixnums. Instead, I suggest that we deprecate > lsh, as it doesn't make sense any more now that integers have unbounded size. It is IMO absurd for us to deprecate a valid and useful operation just because we added bignums. If we cannot agree on its semantics for bignums (which would surprise me), then it is better to make it not work for bignums at all than deprecate it for fixnums. > While we're deprecating it, we can make (lsh A B) signal an error if A is a > bignum and B is negative, since there's nothing we can do there that is > reasonable and is compatible with the fixnum behavior. If that's the best we can do, fine. But it doesn't require deprecating lsh while we are at it. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 19:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153462155831922 (code B ref -1); Sat, 18 Aug 2018 19:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Aug 2018 19:45:58 +0000 Received: from localhost ([127.0.0.1]:54265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr7Ab-0008In-US for submit@debbugs.gnu.org; Sat, 18 Aug 2018 15:45:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr7Aa-0008IY-8w for submit@debbugs.gnu.org; Sat, 18 Aug 2018 15:45:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fr7AS-0001Ml-Jl for submit@debbugs.gnu.org; Sat, 18 Aug 2018 15:45:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50904) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fr7AS-0001Mf-FV for submit@debbugs.gnu.org; Sat, 18 Aug 2018 15:45:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fr7AR-0001TY-Jp for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2018 15:45:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fr7AO-0001LI-Gj for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2018 15:45:47 -0400 Received: from [195.159.176.226] (port=35998 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fr7AO-0001IQ-Ad for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2018 15:45:44 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fr78F-00033B-65 for bug-gnu-emacs@gnu.org; Sat, 18 Aug 2018 21:43:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Sat, 18 Aug 2018 20:45:36 +0100 Lines: 29 Message-ID: <86k1onjw67.fsf@gmail.com> References: <86mutll4w2.fsf@gmail.com> <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) Cancel-Lock: sha1:6TyfNFxnMNDT/+s5lHt4+Pb9eJs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) On Sat 18 Aug 2018, Paul Eggert wrote: > Pip Cet wrote: > >> Paul committed a patch in the meantime (independently, I think?) which >> does add tests. I'll try to write some more. > > Yes, I noticed the logior etc. problem separately and fixed it in master > without knowing about this bug report. There are some other bignum problems > too that need fixing and are in my pipeline. I'm not sure what is on your list of remaining issues, but here is mine: a) A bug in bignumcompare for 64bit Windows. Patch is here: http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00487.html b) fmod_float has a bug: http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00442.html c) Extend Fexpt to support bignums. Patch is here: http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00503.html d) Extend Fceiling, Ffloor, Fround and Ftruncate to support bignums by updating rounding_driver. Please describe any additional issues you have discovered. AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 20:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: andrewjmoreton@gmail.com, pipcet@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15346223581582 (code B ref 32463); Sat, 18 Aug 2018 20:00:03 +0000 Received: (at 32463) by debbugs.gnu.org; 18 Aug 2018 19:59:18 +0000 Received: from localhost ([127.0.0.1]:54270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr7NW-0000PS-4d for submit@debbugs.gnu.org; Sat, 18 Aug 2018 15:59:18 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr7NT-0000Ow-UP for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 15:59:16 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0C16D16087B; Sat, 18 Aug 2018 12:59:10 -0700 (PDT) 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 mqv-RHjms5e4; Sat, 18 Aug 2018 12:59:09 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DFB5E160FBE; Sat, 18 Aug 2018 12:59:08 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 yHDlPSTOkO4p; Sat, 18 Aug 2018 12:59:08 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 758FA16087B; Sat, 18 Aug 2018 12:59:08 -0700 (PDT) References: <86mutll4w2.fsf@gmail.com> <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> <83a7pjfql6.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <0c647d0a-71f9-f3f4-c8af-80ee00ff200a@cs.ucla.edu> Date: Sat, 18 Aug 2018 12:59:07 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <83a7pjfql6.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii wrote: >> we can make (lsh A B) signal an error if A is a >> bignum and B is negative, since there's nothing we can do there that is >> reasonable and is compatible with the fixnum behavior. > If that's the best we can do, fine. OK, let's go that route. > It is IMO absurd for us to deprecate a valid and useful operation just > because we added bignums. It would indeed be absurd if lsh were still valid and useful. However, because lsh assumes fixed-width integers its overall utility is negative for new Elisp code because it mostly just introduces opportunities for confusion. This is why Common Lisp and Scheme don't have lsh. Backward compatibility is the only reason Emacs Lisp should have lsh. (Obviously we can't simply remove lsh.) From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 20:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: eliz@gnu.org Cc: eggert@cs.ucla.edu, andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15346223661627 (code B ref 32463); Sat, 18 Aug 2018 20:00:03 +0000 Received: (at 32463) by debbugs.gnu.org; 18 Aug 2018 19:59:26 +0000 Received: from localhost ([127.0.0.1]:54273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr7Ne-0000Q8-DB for submit@debbugs.gnu.org; Sat, 18 Aug 2018 15:59:26 -0400 Received: from mail-lj1-f179.google.com ([209.85.208.179]:47033) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr7Nb-0000PZ-Ua for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 15:59:24 -0400 Received: by mail-lj1-f179.google.com with SMTP id 203-v6so8796735ljj.13 for <32463@debbugs.gnu.org>; Sat, 18 Aug 2018 12:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UShtSfDc2nSsApwUZVXNycWptUiy1+YZYUdCua01v2k=; b=XHNrICMquF8fSDpclq3FKjh231HKXlfRvaJgXikXB12AktmAgaSgDt26lfz3fAghr6 a0R0XjyI/iPm3Mpd5/RFJ8IRx/3g+QhaRRI+zi2g15iutHxE/bdNCQC/s/K903klUDEY zieC+98Ga/+cSRdjEmfSZPLXE8cqC8zhlEQQJG6CNcpjoylkKSCqvli66JKoM+WOtq+c taLTnNLBcRvRsxW2vAEUKkfJEFw8vZQNBDD0ap5mHrfSS1rKhlpLqBrzkVUsjM5cRlgZ LC9ouofccOORgbVUMRYO7IDdZzdOFG/2LV5YeU2hMUfcADAuP1xTmUL4J3DFcjct36UG k4fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UShtSfDc2nSsApwUZVXNycWptUiy1+YZYUdCua01v2k=; b=JDB+iDkzWTGGLnmmCuz7UzTgN3wbqUWiQv/Fl3r4Cv1pqDxHkfcBOnVVGHX1EXsySI OQhz6lCqDqkKNMxawiE2l1zvtvC9vDv4UKCH7Prnu9/EKP2padP+sYMkMkkfgPpYzcDN Tv+evaeGdN39BcCuFY6W+2FSlQPsG7uM5x5dA8ppUdTAbHnzgzhglXzPUfjSl2OR90gU nWqXx2V0LJhEjaLCcxP/j3Ehbk27zNPXVNOiF6rwYv9dxzRmePl4V9TC/rLHNZz1GIa5 VCPzSfSOHH2EdO1tkIsi0Doco+DXQ/6h85EVWTjs7aoixuzGrcKDKa/eKTi/vi+7QE+B e6qA== X-Gm-Message-State: AOUpUlFK/l3iwk135gB5iAENEuzFpiZQtgN46JEzlUdT3URDE6c4t/5+ kJWmfXTlioCd1U4tQnA03PUZ3BdAQeuvgnAoU5Y= X-Google-Smtp-Source: AA+uWPxRobMoHaOCfaiA6HxEgrwibo21JrK+k4EeQcGN3AC9//hqIFfazU6r0w1CVx9VGjfai/jaxc/EnXvJo9REjrs= X-Received: by 2002:a2e:712:: with SMTP id 18-v6mr29046054ljh.101.1534622358134; Sat, 18 Aug 2018 12:59:18 -0700 (PDT) MIME-Version: 1.0 References: <86mutll4w2.fsf@gmail.com> <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> <83a7pjfql6.fsf@gnu.org> In-Reply-To: <83a7pjfql6.fsf@gnu.org> From: Pip Cet Date: Sat, 18 Aug 2018 19:58:40 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, Aug 18, 2018 at 7:00 PM Eli Zaretskii wrote: > > > From: Paul Eggert > > Date: Sat, 18 Aug 2018 11:48:11 -0700 > > Cc: 32463@debbugs.gnu.org > > > > It would be weird for lsh to act one way for negative bignums, and a different > > and incompatible way for negative fixnums. Instead, I suggest that we deprecate > > lsh, as it doesn't make sense any more now that integers have unbounded size. > > It is IMO absurd for us to deprecate a valid and useful operation just > because we added bignums. If we cannot agree on its semantics for > bignums (which would surprise me), then it is better to make it not > work for bignums at all than deprecate it for fixnums. The recent code changes made `lsh' behave the same as `ash' for fixnums, if I understand correctly. Are you suggesting we revert to the previous behavior, and try to come up with an interpretation for bignums that somehow extends the previous behavior? (In any case, the current code for bignums is inconsistent for the low-order bits that should be unaffected by whatever convention we choose). From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 22:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet , eliz@gnu.org Cc: andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153463127428207 (code B ref 32463); Sat, 18 Aug 2018 22:28:01 +0000 Received: (at 32463) by debbugs.gnu.org; 18 Aug 2018 22:27:54 +0000 Received: from localhost ([127.0.0.1]:54295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr9hI-0007Kp-5m for submit@debbugs.gnu.org; Sat, 18 Aug 2018 18:27:54 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr9hF-0007Ka-Um for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 18:27:50 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A178A160812; Sat, 18 Aug 2018 15:27:43 -0700 (PDT) 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 GHsnyPYS1ZEh; Sat, 18 Aug 2018 15:27:42 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 353AE16081D; Sat, 18 Aug 2018 15:27:42 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 kUGhWKUwcxkI; Sat, 18 Aug 2018 15:27:42 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A983B160812; Sat, 18 Aug 2018 15:27:41 -0700 (PDT) References: <86mutll4w2.fsf@gmail.com> <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> <83a7pjfql6.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sat, 18 Aug 2018 15:27:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------11C2C37ECEACB3BEC69DB9CE" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------11C2C37ECEACB3BEC69DB9CE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Pip Cet wrote: > Are you suggesting we revert to > the previous behavior, and try to come up with an interpretation for > bignums that somehow extends the previous behavior? I think Eli was suggesting reverting lsh to the traditional behavior for fixnums, for backwards-compatibility reasons. There doesn't seem to be a good way to extend this behavior for bignums, so I installed the attached patch that simply makes it an error to invoke (lsh A B) where A is a negative bignum and B is negative. This patch also adds some test cases inspired by one of your previous emails (thanks). --------------11C2C37ECEACB3BEC69DB9CE Content-Type: text/plain; charset=UTF-8; name="0001-Restore-traditional-lsh-behavior-on-fixnums.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-Restore-traditional-lsh-behavior-on-fixnums.txt" RnJvbSA2NzNiMTc4NWRiNDYwNGVmZTgxYjgwNDVhOWQ4YWI2ODkzNmFmNzE5IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTYXQsIDE4IEF1ZyAyMDE4IDE1OjIwOjQ2IC0wNzAwClN1YmplY3Q6IFtQQVRD SF0gUmVzdG9yZSB0cmFkaXRpb25hbCBsc2ggYmVoYXZpb3Igb24gZml4bnVtcwpNSU1FLVZl cnNpb246IDEuMApDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9VVRGLTgKQ29u dGVudC1UcmFuc2Zlci1FbmNvZGluZzogOGJpdAoKKiBkb2MvbGlzcHJlZi9udW1iZXJzLnRl eGkgKEJpdHdpc2UgT3BlcmF0aW9ucyk6IERvY3VtZW50IHRoYXQKdGhlIHRyYWRpdGlvbmFs IChsc2ggQSBCKSBiZWhhdmlvciBpcyBmb3IgZml4bnVtcywgYW5kIHRoYXQgaXQKaXMgYW4g ZXJyb3IgaWYgQSBhbmQgQiBhcmUgYm90aCBuZWdhdGl2ZSBhbmQgQSBpcyBhIGJpZ251bS4K U2VlIEJ1ZyMzMjQ2My4KKiBsaXNwL3N1YnIuZWwgKGxzaCk6IE5ldyBmdW5jdGlvbiwgbW92 ZWQgaGVyZSBmcm9tIHNyYy9kYXRhLmMuCiogc3JjL2RhdGEuYyAoYXNoX2xzaF9pbXBsKTog UmVtb3ZlLCBtb3ZpbmcgYm9keSBpbnRvIEZhc2gKc2luY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0xKSAoLyBtb3N0LXBvc2l0aXZlLWZpeG51bSAy KSkpCisgIChzaG91bGQgKD0gKGxzaCBtb3N0LW5lZ2F0aXZlLWZpeG51bSAtMSkgKGxzaCAo LSBtb3N0LW5lZ2F0aXZlLWZpeG51bSkgLTEpKSkKKyAgKHNob3VsZCAoPSAobHNoIC0xIC0x KSBtb3N0LXBvc2l0aXZlLWZpeG51bSkpCisgIChzaG91bGQtZXJyb3IgKGxzaCAoMS0gbW9z dC1uZWdhdGl2ZS1maXhudW0pIC0xKSkpCiAKIDs7OyBkYXRhLXRlc3RzLmVsIGVuZHMgaGVy ZQotLSAKMi4xNy4xCgo= --------------11C2C37ECEACB3BEC69DB9CE-- From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 22:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet , andrewjmoreton@gmail.com Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153463224629999 (code B ref 32463); Sat, 18 Aug 2018 22:45:02 +0000 Received: (at 32463) by debbugs.gnu.org; 18 Aug 2018 22:44:06 +0000 Received: from localhost ([127.0.0.1]:54301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr9wy-0007nl-I4 for submit@debbugs.gnu.org; Sat, 18 Aug 2018 18:44:04 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:43856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fr9ww-0007n8-5K for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 18:44:02 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 74E7D16081D; Sat, 18 Aug 2018 15:43:56 -0700 (PDT) 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 8jTn7xfdJ2_r; Sat, 18 Aug 2018 15:43:55 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7C654160825; Sat, 18 Aug 2018 15:43:55 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 tXgFu9k86uog; Sat, 18 Aug 2018 15:43:55 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 15CDE16081D; Sat, 18 Aug 2018 15:43:55 -0700 (PDT) References: <86mutll4w2.fsf@gmail.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sat, 18 Aug 2018 15:43:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------C1DB9F9EEC98A33F2528B165" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------C1DB9F9EEC98A33F2528B165 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Pip Cet wrote: > I'm attaching the patch that I think should still be applied, which > includes some tests. Thanks. I think most of that patch was addressed by my previous patch, except for the doc changes for 'random' for which I installed the attached. --------------C1DB9F9EEC98A33F2528B165 Content-Type: text/plain; charset=UTF-8; name="0001-Document-that-random-is-limited-to-fixnums.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-Document-that-random-is-limited-to-fixnums.txt" RnJvbSA5N2QyNzMwMzNiNTIzYmMwNzkxMWM4NDhkNGU4YmY5NmNkY2UwYzkwIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTYXQsIDE4IEF1ZyAyMDE4IDE1OjM5OjA1IC0wNzAwClN1YmplY3Q6IFtQQVRD SF0gPT9VVEYtOD9xP0RvY3VtZW50PTIwdGhhdD0yMD1FMj04MD05OHJhbmRvbT1FMj04MD05 OT0yMGlzPz0KID0/VVRGLTg/cT89MjBsaW1pdGVkPTIwdG89MjBmaXhudW1zPz0KTUlNRS1W ZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PVVURi04CkNv bnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IDhiaXQKClByb2JsZW0gcmVwb3J0ZWQgYnkgUGlw IENldCAoQnVnIzMyNDYzIzIwKS4KKiBkb2MvbGlzcHJlZi9udW1iZXJzLnRleGkgKFJhbmRv bSBOdW1iZXJzKToKKiBzcmMvZm5zLmMgKEZyYW5kb20pOiBBZGp1c3QgZG9jLgotLS0KIGRv Yy9saXNwcmVmL251bWJlcnMudGV4aSB8IDcgKysrLS0tLQogc3JjL2Zucy5jICAgICAgICAg ICAgICAgIHwgOSArKystLS0tLS0KIDIgZmlsZXMgY2hhbmdlZCwgNiBpbnNlcnRpb25zKCsp LCAxMCBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9kb2MvbGlzcHJlZi9udW1iZXJzLnRl eGkgYi9kb2MvbGlzcHJlZi9udW1iZXJzLnRleGkKaW5kZXggZWU2NDU2Yj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GFibGUsIG90aGVyd2lzZSBmcm9tIGxlc3MtcmFuZG9tIHZv bGF0aWxlIGRhdGEgc3VjaCBhcyB0aGUgdGltZS4KIFdpdGggYSBzdHJpbmcgYXJndW1lbnQs IHNldCB0aGUgc2VlZCBiYXNlZCBvbiB0aGUgc3RyaW5nJ3MgY29udGVudHMuCi1PdGhlciB2 YWx1ZXMgb2YgTElNSVQgYXJlIGlnbm9yZWQuCiAKIFNlZSBJbmZvIG5vZGUgYChlbGlzcClS YW5kb20gTnVtYmVycycgZm9yIG1vcmUgZGV0YWlscy4gICovKQogICAoTGlzcF9PYmplY3Qg bGltaXQpCi0tIAoyLjE3LjEKCg== --------------C1DB9F9EEC98A33F2528B165-- From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 References: In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 22:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andy Moreton Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153463302532015 (code B ref 32463); Sat, 18 Aug 2018 22:58:02 +0000 Received: (at 32463) by debbugs.gnu.org; 18 Aug 2018 22:57:05 +0000 Received: from localhost ([127.0.0.1]:54305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frA9Z-0008KJ-6D for submit@debbugs.gnu.org; Sat, 18 Aug 2018 18:57:05 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frA9X-0008Jn-Fg for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 18:57:03 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E2D9916081D; Sat, 18 Aug 2018 15:56:57 -0700 (PDT) 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 BZVn0lW8i6Oy; Sat, 18 Aug 2018 15:56:56 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D5F6E160825; Sat, 18 Aug 2018 15:56:56 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 J0yquey7Vcj1; Sat, 18 Aug 2018 15:56:56 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 87EAF16081D; Sat, 18 Aug 2018 15:56:56 -0700 (PDT) From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> Date: Sat, 18 Aug 2018 15:56:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > I'm not sure what is on your list of remaining issues, but here is mine: > > a) A bug in bignumcompare for 64bit Windows. Patch is here: > http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00487.html That patch doesn't go far enough, I'm afraid, as there are other bugs in bignum comparison. For example, NaNs vs bignums don't always work. And while we're in the neighborhood one can more cheaply compare a fixnum to a bignum by simply looking at the bignum's sign, as the numeric values don't matter in that case. This item is first on my list of things to fix partly because it's relatively easy. > b) fmod_float has a bug: > http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00442.html > > c) Extend Fexpt to support bignums. Patch is here: > http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00503.html > > d) Extend Fceiling, Ffloor, Fround and Ftruncate to support bignums by > updating rounding_driver. These are all news to me; thanks for the list. There are some relatively minor things involving removal of assumption that there are no padding bits (OK, so Emacs is not likely to run on Crays any time soon, but it's easy to port). My bigger concern is memory management, along with integer overflow in size or bitcount calculation. Copies are made of bignums when not needed, behavior is dicey if memory is exhausted during bignum computation, and I'm afraid C-g will have problems when bignums get large. I don't have a good handle on this stuff yet. I have put in some sanity checks (e.g., see check_bignum_size in emacs.c) but I suspect more are needed. In particular, Fexpt will need to be careful as it is a good way to explode a bignum's size. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Aug 2018 23:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andy Moreton Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15346342601897 (code B ref 32463); Sat, 18 Aug 2018 23:18:01 +0000 Received: (at 32463) by debbugs.gnu.org; 18 Aug 2018 23:17:40 +0000 Received: from localhost ([127.0.0.1]:54311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frATT-0000UX-VK for submit@debbugs.gnu.org; Sat, 18 Aug 2018 19:17:40 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:46266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frATR-0000UJ-Hb for 32463@debbugs.gnu.org; Sat, 18 Aug 2018 19:17:38 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F387716081D; Sat, 18 Aug 2018 16:17:31 -0700 (PDT) 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 GxZ_NAZMN8F3; Sat, 18 Aug 2018 16:17:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C5578160825; Sat, 18 Aug 2018 16:17:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 bMqCtIjt4d-F; Sat, 18 Aug 2018 16:17:30 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 6DEF116081D; Sat, 18 Aug 2018 16:17:30 -0700 (PDT) From: Paul Eggert References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> Organization: UCLA Computer Science Department Message-ID: <1c974d87-aa99-55ee-a8ff-9710275176d1@cs.ucla.edu> Date: Sat, 18 Aug 2018 16:17:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> Content-Type: multipart/mixed; boundary="------------11A65E7E81DA8E703A89062B" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------11A65E7E81DA8E703A89062B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Paul Eggert wrote: > This item is first on my list of things to fix partly because it's relatively easy. No time like the present, so I installed the attached. --------------11A65E7E81DA8E703A89062B Content-Type: text/plain; charset=UTF-8; name="0001-Improve-bignum-comparison-Bug-32463-50.fix" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-Improve-bignum-comparison-Bug-32463-50.fix" RnJvbSAxZDJkZjJmZDAzZjM1Y2E4ZDhkZmM4Yjk5OWQ4YmJhM2M3YzEzMTU3IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTYXQsIDE4IEF1ZyAyMDE4IDE2OjEzOjA0IC0wNzAwClN1YmplY3Q6IFtQQVRD SF0gSW1wcm92ZSBiaWdudW0gY29tcGFyaXNvbiAoQnVnIzMyNDYzIzUwKQpNSU1FLVZlcnNp b246IDEuMApDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9VVRGLTgKQ29udGVu dC1UcmFuc2Zlci1FbmNvZGluZzogOGJpdAoKKiBzcmMvZGF0YS5jIChpc25hbik6IFJlbW92 ZSwgYXMgd2UgY2FuIGFzc3VtZSBDOTkuCihiaWdudW1jb21wYXJlKTogUmVtb3ZlLCBmb2xk aW5nIGl0cyBmdW5jdGlvbmFsaXR5CmludG8gYXJpdGhjb21wYXJlLgooYXJpdGhjb21wYXJl KTogQ29tcGFyZSBiaWdudW1zIGRpcmVjdGx5IGhlcmUuCkZpeCBidWdzIHdoZW4gY29tcGFy aW5nIE5hTnMgdG8gYmlnbnVtcy4KV2hlbiBjb21wYXJpbmcgYSBiaWdudW0gdG8gYSBmaXhu dW0sIGp1c3QgbG9vayBhdCB0aGUKYmlnbn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ndCBkZWZpbmUgY29tcGFyaXNvbnMgYWdhaW5zdCBO YU4sIHNvCi0JICAgICB3ZSBuZWVkIHRvIGhhbmRsZSB0aGVtIHNwZWNpYWxseS4gICovCi0J ICBpZiAoaXNuYW4gKFhGTE9BVF9EQVRBIChudW0yKSkpCi0JICAgIHJldHVybiBRbmlsOwot CSAgY21wID0gbXB6X2NtcF9kIChYQklHTlVNIChudW0xKS0+dmFsdWUsIFhGTE9BVF9EQVRB IChudW0yKSk7Ci0JfQotICAgICAgZWxzZSBpZiAoRklYTlVNUCAobnVtMikpCi0gICAgICAg IHsKLSAgICAgICAgICBpZiAoc2l6ZW9mIChFTUFDU19JTlQpID4gc2l6ZW9mIChsb25nKSAm JiBYRklYTlVNIChudW0yKSA+IExPTkdfTUFYKQotICAgICAgICAgICAgewotICAgICAgICAg ICAgICBtcHpfdCB0ZW07Ci0gICAgICAgICAgICAgIG1wel9pbml0ICh0ZW0pOwotICAgICAg ICAgICAgICBtcHpfc2V0X2ludG1heCAodGVtLCBYRklYTlVNIChudW0yKSk7Ci0gICAgICAg ICAgICAgIGNtcCA9IG1wel9jbXAgKFhCSUdOVU0gKG51bTEpLT52YWx1ZSwgdGVtKTsKLSAg ICAgICAgICAgICAgbXB6X2NsZWFyICh0ZW0pOwotICAgICAgICAgICAgfQotICAgICAgICAg IGVsc2UKLSAgICAgICAgICAgIGNtcCA9IG1wel9jbXBfc2kgKFhCSUdOVU0gKG51bTEpLT52 YWx1ZSwgWEZJWE5VTSAobnVtMikpOwotICAgICAgICB9Ci0gICAgICBlbHNlCi0JewotCSAg ZWFzc3VtZSAoQklHTlVNUCAobnVtMikpOwotCSAgY21wID0gbXB6X2NtcCAoWEJJR05VTSAo bnVtMSktPnZhbHVlLCBYQklHTlVNIChudW0yKS0+dmFsdWUpOwotCX0KLSAgICB9Ci0gIGVs c2UKLSAgICB7Ci0gICAgICBlYXNzdW1lIChCSUdOVU1QIChudW0yKSk7Ci0gICAgICBpZiAo RkxPQVRQIChudW0xKSkKLQl7Ci0JICAvKiBOb3RlIHRoYXQgR01QIGRvZXNuJ3QgZGVmaW5l IGNvbXBhcmlzb25zIGFnYWluc3QgTmFOLCBzbwotCSAgICAgd2UgbmVlZCB0byBoYW5kbGUg dGhlbSBzcGVjaWFsbHkuICAqLwotCSAgaWYgKGlzbmFuIChYRkxPQVRfREFUQSAobnVtMSkp KQotCSAgICByZXR1cm4gUW5pbDsKLQkgIGNtcCA9IC0gbXB6X2NtcF9kIChYQklHTlVNIChu dW0yKS0+dmFsdWUsIFhGTE9BVF9EQVRBIChudW0xKSk7Ci0JfQotICAgICAgZWxzZQotICAg ICAgICB7Ci0JICBlYXNzdW1lIChGSVhOVU1QIChudW0xKSk7Ci0gICAgICAgICAgaWYgKHNp emVvZiAoRU1BQ1NfSU5UKSA+IHNpemVvZiAobG9uZykgJiYgWEZJWE5VTSAobnVtMSkgPiBM T05HX01BWCkKLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgbXB6X3QgdGVtOwotICAg ICAgICAgICAgICBtcHpfaW5pdCAodGVtKTsKLSAgICAgICAgICAgICAgbXB6X3NldF9pbnRt YXggKHRlbSwgWEZJWE5VTSAobnVtMSkpOwotICAgICAgICAgICAgICBjbXAgPSAtIG1wel9j bXAgKFhCSUdOVU0gKG51bTIpLT52YWx1ZSwgdGVtKTsKLSAgICAgICAgICAgICAgbXB6X2Ns ZWFyICh0ZW0pOwotICAgICAgICAgICAgfQotICAgICAgICAgIGVsc2UKLSAgICAgICAgICAg IGNtcCA9IC0gbXB6X2NtcF9zaSAoWEJJR05VTSAobnVtMiktPnZhbHVlLCBYRklYTlVNIChu dW0xKSk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgc3dpdGNoIChjb21wYXJpc29uKQotICAg IHsKLSAgICBjYXNlIEFSSVRIX0VRVUFMOgotICAgICAgdGVzdCA9IGNtcCA9PSAwOwotICAg ICAgYnJlYWs7Ci0KLSAgICBjYXNlIEFSSVRIX05PVEVRVUFMOgot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IGYxID4gZjI7CisgICAgICBlbHNlIGlmIChpc25hbiAo ZjEpKQorCWx0ID0gZXEgPSBndCA9IGZhbHNlOworICAgICAgZWxzZQorCWkyID0gbXB6X2Nt cF9kIChYQklHTlVNIChudW0yKS0+dmFsdWUsIGYxKTsKICAgICB9Ci0gIGVsc2UKKyAgZWxz ZSBpZiAoRklYTlVNUCAobnVtMSkpCiAgICAgewotICAgICAgaTEgPSBYRklYTlVNIChudW0x KTsKICAgICAgIGlmIChGTE9BVFAgKG51bTIpKQogCXsKIAkgIC8qIENvbXBhcmUgYW4gaW50 ZWdlciBOVU0xIHRvIGEgZmxvYXQgTlVNMi4gIFRoaXMgaXMgdGhlCiAJICAgICBjb252ZXJz ZSBvZiBjb21wYXJpbmcgZmxvYXQgdG8gaW50ZWdlciAoc2VlIGFib3ZlKS4gICovCi0JICBp MiA9IGYxID0gaTE7Ci0JICBmMiA9IFhGTE9BVF9EQVRBIChudW0yKTsKKwkgIGRvdWJsZSBm MSA9IFhGSVhOVU0gKG51bTEpLCBmMiA9IFhGTE9BVF9EQVRBIChudW0yKTsKIAkgIGx0ID0g ZjEgPCBmMjsKIAkgIGVxID0gZjEgPT0gZjI7CiAJICBndCA9IGYxID4gZjI7CisJICBpMSA9 IFhGSVhOVU0gKG51bTEpOworCSAgaTIgPSBmMTsKIAl9Ci0gICAgICBlbHNlCisgICAgICBl bHNlIGlmIChGSVhOVU1QIChudW0yKSkKIAl7CisJICBpMSA9IFhGSVhOVU0gKG51bTEpOwog CSAgaTIgPSBYRklYTlVNIChudW0yKTsKLQkgIGVxID0gdHJ1ZTsKIAl9CisgICAgICBlbHNl CisJaTIgPSBtcHpfc2duIChYQklHTlVNIChudW0yKS0+dmFsdWUpOwogICAgIH0KKyAgZWxz ZSBpZiAoRkxPQVRQIChudW0yKSkKKyAgICB7CisgICAgICBkb3VibGUgZjIgPSBYRkxPQVRf REFUQSAobnVtMik7CisgICAgICBpZiAoaXNuYW4gKGYyKSkKKwlsdCA9IGVx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worICAgIChz aG91bGQgKC89IGIwIDAuMGUrTmFOKSkKKyAgICAoc2hvdWxkICgvPSBiLTEgMC4wZStOYU4p KSkpCiAKIChlcnQtZGVmdGVzdCBkYXRhLXRlc3RzLSsgKCkKICAgKHNob3VsZC1ub3QgKGZp eG51bXAgKCsgbW9zdC1wb3NpdGl2ZS1maXhudW0gbW9zdC1wb3NpdGl2ZS1maXhudW0pKSkK LS0gCjIuMTcuMQoK --------------11A65E7E81DA8E703A89062B-- From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 10:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1534674916363 (code B ref -1); Sun, 19 Aug 2018 10:36:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Aug 2018 10:35:16 +0000 Received: from localhost ([127.0.0.1]:54400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frL3E-00005n-38 for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:35:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frL3C-00005a-Sd for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:35:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frL37-0008Be-6g for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:35:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41813) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frL37-0008BT-4E for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:35:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frL36-0005mx-DI for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 06:35:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frL33-0008Ao-Af for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 06:35:08 -0400 Received: from [195.159.176.226] (port=51992 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frL33-0008Ah-3v for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 06:35:05 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1frL0u-0004Oy-71 for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 12:32:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Sun, 19 Aug 2018 11:34:55 +0100 Lines: 17 Message-ID: <866006tzjk.fsf@gmail.com> References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:BVHAMESTmQywu1OQNq+y09/0lCE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) On Sat 18 Aug 2018, Paul Eggert wrote: > My bigger concern is memory management, along with integer overflow in size or > bitcount calculation. Copies are made of bignums when not needed, behavior is > dicey if memory is exhausted during bignum computation, and I'm afraid C-g > will have problems when bignums get large. I don't have a good handle on this > stuff yet. I have put in some sanity checks (e.g., see check_bignum_size in > emacs.c) but I suspect more are needed. In particular, Fexpt will need to be > careful as it is a good way to explode a bignum's size. Indeed. There are many places that create a temporary bignum, and thus call mpz_init/mpz_clear frequently. I haven't profiled this, but it may be an opportunuty for some optimization. Fixing C-g will require awkward changes to either GMP and/or emacs. AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Live System User Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 10:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15346754562070 (code B ref -1); Sun, 19 Aug 2018 10:45:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Aug 2018 10:44:16 +0000 Received: from localhost ([127.0.0.1]:54404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLBv-0000XJ-Vi for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:44:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49179) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLBu-0000Wp-FA for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:44:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frLBo-0002Vd-JI for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:44:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frLBo-0002VW-Gi for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:44:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frLBn-0008Cw-No for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 06:44:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frLBi-0002Uy-Mw for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 06:44:07 -0400 Received: from [195.159.176.226] (port=35439 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frLBi-0002Ur-FD for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 06:44:02 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1frL9Y-0006gP-Pk for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 12:41:48 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Live System User Date: Sun, 19 Aug 2018 06:43:39 -0400 Lines: 53 Message-ID: <878t52ab6s.fsf@aol.com> References: <86mutll4w2.fsf@gmail.com> <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> <86k1onjw67.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cancel-Lock: sha1:WTvwjyh5Lx211kmhzvb64/m0y70= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Andy Moreton writes: > On Sat 18 Aug 2018, Paul Eggert wrote: > >> Pip Cet wrote: >> >>> Paul committed a patch in the meantime (independently, I think?) which >>> does add tests. I'll try to write some more. >> >> Yes, I noticed the logior etc. problem separately and fixed it in master >> without knowing about this bug report. There are some other bignum problems >> too that need fixing and are in my pipeline. > > I'm not sure what is on your list of remaining issues, but here is mine: > > a) A bug in bignumcompare for 64bit Windows. Patch is here: > http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00487.html > > b) fmod_float has a bug: > http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00442.html > > c) Extend Fexpt to support bignums. Patch is here: > http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00503.html > > d) Extend Fceiling, Ffloor, Fround and Ftruncate to support bignums by > updating rounding_driver. > > Please describe any additional issues you have discovered. There also appears to be a bug dealing with date/time convesion (maybe a float issue?): M-: (date-to-time "Tue, 06 Mar 2018 11:17:02 -0500") Invalid date: Tue, 06 Mar 2018 11:17:02 -0500 When the date/time is being parsed you eroneouse get: M-: (parse-time-string "Tue, 06 Mar 2018 11:17:02 -0500") (nil nil nil 6 3 2018 2 nil nil) With Emacs 26.1, you get: (2 17 11 6 3 2018 2 nil -18000) See bug#32443 Thanks. > > AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 10:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: eggert@cs.ucla.edu Cc: andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15346757463617 (code B ref 32463); Sun, 19 Aug 2018 10:50:02 +0000 Received: (at 32463) by debbugs.gnu.org; 19 Aug 2018 10:49:06 +0000 Received: from localhost ([127.0.0.1]:54408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLGa-0000wD-I1 for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:49:05 -0400 Received: from mail-lj1-f181.google.com ([209.85.208.181]:43455) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLGZ-0000vH-4e for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 06:49:03 -0400 Received: by mail-lj1-f181.google.com with SMTP id r13-v6so9444309ljg.10 for <32463@debbugs.gnu.org>; Sun, 19 Aug 2018 03:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Jx0AlwvHOqXLMq/guzGydQ56nHmx4QnSS0FjQ6IBXyk=; b=C6UoriKo7KqIEwUfVJUdM5WEmEYFxqmgQLe0bUKNDnpJ5/iouMm9rdM9yvql6iet2F SImezPJZkQzQzJnUQYwQhhIOje5AAi2+0zpc4vTr3OUFztd+ff6poOXs6TvA/n0BgTsy 7yc+oPMsQcPQqviMQGokUFaTcaKqHHO3BcOt2cUdshIARPmHtbk6lKsubE8e3xUoM77p JDuVMz+WpotNnR/QUjWLPaJdKcOkogF9zzyHcMaHnsS+t6uJH0NJrrEjjaXQ6amsz0O/ 2LvREZps0PpU3O2NITuji7ijFl69i/YD9iMdc3phb3x+sUHWwVLwvGLjDE5oJ4kKTuVd +30Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Jx0AlwvHOqXLMq/guzGydQ56nHmx4QnSS0FjQ6IBXyk=; b=cU8QWUGe427hAPrOcBDoYTZ4M1Tras6sTqKcYEiRGHEjUdC6Kwz5SexxLDw63vH740 BSBQa7CAWTc46jqaBCczwvqLIOvU5Q31znIBH2HPW5Yng/fdzFKwie70PSwvdd/iODLW AeLF2muzcrI5k7/LPVL4Wuert1mQjqA+3Hk8bU5W8FM7wNRfzWabdD3s1vfOhNMhzxLm 1BZzcFQdRUXo4zvtrYkxOQ7zCGKHt6jjm1hk72AmyxKSa6TE0mx7FjvO1Ie2xZub68Oj smoZZM9ojkIpAp9JxH/+IezEs9OnjWS8FRYeEKBoCCXrw9HIidlyve199cevMG6rdBfU aOmg== X-Gm-Message-State: AOUpUlEdhNKy5KYvrEJDtUd+uP853olYkO2ZXEg4E8jpaQQWMTxu2fzm HsZgvFXYbZGG62UH2DIh+8r8h8vitwjkBT59cs0= X-Google-Smtp-Source: AA+uWPzi8lni1/0tx6wcgVozKpNPqLw1YzRjXeTbx+45iy6GUz8pq6D7BE7XVqb3TER7KGefeSPZ0HJ1HATSMGBhwzQ= X-Received: by 2002:a2e:5243:: with SMTP id g64-v6mr27945281ljb.144.1534675737366; Sun, 19 Aug 2018 03:48:57 -0700 (PDT) MIME-Version: 1.0 References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> In-Reply-To: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> From: Pip Cet Date: Sun, 19 Aug 2018 10:48:19 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, Aug 18, 2018 at 10:58 PM Paul Eggert wrote: My bigger concern is memory management, along with integer overflow in size or > bitcount calculation. Copies are made of bignums when not needed, behavior is > dicey if memory is exhausted during bignum computation, and I'm afraid C-g will > have problems when bignums get large. Even if memory isn't exhausted, creating a bignum larger than 16 GB (our most-positive-bignum) results in an immediate crash with external libgmp (Linux, x86_64), and that appears not to be easy to fix without modifying gmp. > I don't have a good handle on this stuff > yet. I have put in some sanity checks (e.g., see check_bignum_size in emacs.c) > but I suspect more are needed. In particular, Fexpt will need to be careful as > it is a good way to explode a bignum's size. That and left shifts are probably the ones to worry about for now. Creating a large bignum by repeated multiplication will require at least some intermediate bignums, which need to be allocated and copied and thus probably alert the user to something going on. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 10:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andy Moreton Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15346759864986 (code B ref 32463); Sun, 19 Aug 2018 10:54:01 +0000 Received: (at 32463) by debbugs.gnu.org; 19 Aug 2018 10:53:06 +0000 Received: from localhost ([127.0.0.1]:54412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLKU-0001IM-8H for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:53:06 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:58002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLKS-0001HK-1v for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 06:53:04 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EAF3716081D; Sun, 19 Aug 2018 03:52:57 -0700 (PDT) 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 Ve21TKXzgGxc; Sun, 19 Aug 2018 03:52:56 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A767E16087B; Sun, 19 Aug 2018 03:52:56 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 3IMvZaEb4_v1; Sun, 19 Aug 2018 03:52:56 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 574A216081D; Sun, 19 Aug 2018 03:52:56 -0700 (PDT) From: Paul Eggert References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> Organization: UCLA Computer Science Department Message-ID: <66c3b06d-bf67-8f61-4b13-1debf0668010@cs.ucla.edu> Date: Sun, 19 Aug 2018 03:52:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> Content-Type: multipart/mixed; boundary="------------7320B30EED029E4B6B51CAC8" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------7320B30EED029E4B6B51CAC8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable >> a) A bug in bignumcompare for 64bit Windows. Patch is here: >> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00487.html >> ... >> b) fmod_float has a bug: >> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00442.html >> >> c) Extend Fexpt to support bignums. Patch is here: >> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00503.html >> >> d) Extend Fceiling, Ffloor, Fround and Ftruncate to support bignums by >> =C2=A0=C2=A0 updating rounding_driver. I worked on these and installed patches to master that should do (a), (b)= , and=20 (c). For (d) I wrote the attached patch, and plan to test it a bit more b= efore=20 installing, as it's the hairiest. --------------7320B30EED029E4B6B51CAC8 Content-Type: text/x-patch; name="rounding.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rounding.diff" diff --git a/src/floatfns.c b/src/floatfns.c index 54d068c29e..e06657219d 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -379,10 +379,10 @@ This is the same as the exponent of a float. */) static Lisp_Object rounding_driver (Lisp_Object arg, Lisp_Object divisor, double (*double_round) (double), - EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT), + void (*int_divide) (mpz_t, mpz_t const, mpz_t const), const char *name) { - CHECK_FIXNUM_OR_FLOAT (arg); + CHECK_NUMBER (arg); double d; if (NILP (divisor)) @@ -393,12 +393,25 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor, } else { - CHECK_FIXNUM_OR_FLOAT (divisor); + CHECK_NUMBER (divisor); if (!FLOATP (arg) && !FLOATP (divisor)) { - if (XFIXNUM (divisor) == 0) + if (EQ (divisor, make_fixnum (0))) xsignal0 (Qarith_error); - return make_fixnum (int_round2 (XFIXNUM (arg), XFIXNUM (divisor))); + mpz_t d, q; + mpz_init (d); + mpz_init (q); + int_divide (q, + (FIXNUMP (arg) + ? (mpz_set_intmax (q, XFIXNUM (arg)), q) + : XBIGNUM (arg)->value), + (FIXNUMP (divisor) + ? (mpz_set_intmax (d, XFIXNUM (divisor)), d) + : XBIGNUM (arg)->value)); + Lisp_Object result = make_number (q); + mpz_clear (d); + mpz_clear (q); + return result; } double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XFIXNUM (arg); @@ -422,37 +435,39 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor, xsignal2 (Qrange_error, build_string (name), arg); } -static EMACS_INT -ceiling2 (EMACS_INT i1, EMACS_INT i2) -{ - return i1 / i2 + ((i1 % i2 != 0) & ((i1 < 0) == (i2 < 0))); -} - -static EMACS_INT -floor2 (EMACS_INT i1, EMACS_INT i2) -{ - return i1 / i2 - ((i1 % i2 != 0) & ((i1 < 0) != (i2 < 0))); -} - -static EMACS_INT -truncate2 (EMACS_INT i1, EMACS_INT i2) -{ - return i1 / i2; -} - -static EMACS_INT -round2 (EMACS_INT i1, EMACS_INT i2) -{ - /* The C language's division operator gives us one remainder R, but - we want the remainder R1 on the other side of 0 if R1 is closer - to 0 than R is; because we want to round to even, we also want R1 - if R and R1 are the same distance from 0 and if C's quotient is - odd. */ - EMACS_INT q = i1 / i2; - EMACS_INT r = i1 % i2; - EMACS_INT abs_r = eabs (r); - EMACS_INT abs_r1 = eabs (i2) - abs_r; - return q + (abs_r + (q & 1) <= abs_r1 ? 0 : (i2 ^ r) < 0 ? -1 : 1); +static void +rounddiv_q (mpz_t q, mpz_t const n, mpz_t const d) +{ + /* mpz_tdiv_qr gives us one remainder R, but we want the remainder + R1 on the other side of 0 if R1 is closer to 0 than R is; because + we want to round to even, we also want R1 if R and R1 are the + same distance from 0 and if the quotient is odd. + + If we were using EMACS_INT arithmetic instead of bignums, + the following code could look something like this: + + q = n / d; + r = n % d; + neg_d = d < 0; + neg_r = r < 0; + r = eabs (r); + abs_r1 = eabs (d) - r; + if (abs_r1 < r + (q & 1)) + q += neg_d == neg_r ? 1 : -1; */ + + mpz_t r, abs_r1; + mpz_init (r); + mpz_init (abs_r1); + mpz_tdiv_qr (q, r, n, d); + bool neg_d = mpz_sgn (d) < 0; + bool neg_r = mpz_sgn (r) < 0; + mpz_abs (r, r); + mpz_abs (abs_r1, d); + mpz_sub (abs_r1, abs_r1, r); + if (mpz_cmp (abs_r1, r) < (mpz_odd_p (q) != 0)) + (neg_d == neg_r ? mpz_add_ui : mpz_sub_ui) (q, q, 1); + mpz_clear (r); + mpz_clear (abs_r1); } /* The code uses emacs_rint, so that it works to undefine HAVE_RINT @@ -483,7 +498,7 @@ This rounds the value towards +inf. With optional DIVISOR, return the smallest integer no less than ARG/DIVISOR. */) (Lisp_Object arg, Lisp_Object divisor) { - return rounding_driver (arg, divisor, ceil, ceiling2, "ceiling"); + return rounding_driver (arg, divisor, ceil, mpz_cdiv_q, "ceiling"); } DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0, @@ -492,7 +507,7 @@ This rounds the value towards -inf. With optional DIVISOR, return the largest integer no greater than ARG/DIVISOR. */) (Lisp_Object arg, Lisp_Object divisor) { - return rounding_driver (arg, divisor, floor, floor2, "floor"); + return rounding_driver (arg, divisor, floor, mpz_fdiv_q, "floor"); } DEFUN ("round", Fround, Sround, 1, 2, 0, @@ -505,7 +520,7 @@ your machine. For example, (round 2.5) can return 3 on some systems, but 2 on others. */) (Lisp_Object arg, Lisp_Object divisor) { - return rounding_driver (arg, divisor, emacs_rint, round2, "round"); + return rounding_driver (arg, divisor, emacs_rint, rounddiv_q, "round"); } DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0, @@ -514,7 +529,7 @@ Rounds ARG toward zero. With optional DIVISOR, truncate ARG/DIVISOR. */) (Lisp_Object arg, Lisp_Object divisor) { - return rounding_driver (arg, divisor, trunc, truncate2, "truncate"); + return rounding_driver (arg, divisor, trunc, mpz_tdiv_q, "truncate"); } --------------7320B30EED029E4B6B51CAC8-- From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 11:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15346763715783 (code B ref 32463); Sun, 19 Aug 2018 11:00:02 +0000 Received: (at 32463) by debbugs.gnu.org; 19 Aug 2018 10:59:31 +0000 Received: from localhost ([127.0.0.1]:54420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLQf-0001VA-BN for submit@debbugs.gnu.org; Sun, 19 Aug 2018 06:59:29 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:58250) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLQe-0001Uy-FQ for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 06:59:28 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CB15F16081D; Sun, 19 Aug 2018 03:59:22 -0700 (PDT) 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 uOM1BIZvsJcj; Sun, 19 Aug 2018 03:59:22 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 180C516087B; Sun, 19 Aug 2018 03:59:22 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 gp9Ek0_ke5B2; Sun, 19 Aug 2018 03:59:21 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id B0C5B16081D; Sun, 19 Aug 2018 03:59:21 -0700 (PDT) References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sun, 19 Aug 2018 03:59:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Pip Cet wrote: > Even if memory isn't exhausted, creating a bignum larger than 16 GB > (our most-positive-bignum) results in an immediate crash with external > libgmp (Linux, x86_64), and that appears not to be easy to fix without > modifying gmp. Is there a libgmp bug report for this? or is there a reasonable way to characterize this arbitrary limitation in libgmp, so that Emacs does not go over the limit and crash? I've already put in one limit, and we can tighten that limit (or add more checks) if we know what libgmp's limits are. > That and left shifts are probably the ones to worry about for now. > Creating a large bignum by repeated multiplication will require at > least some intermediate bignums, which need to be allocated and copied > and thus probably alert the user to something going on. expt does bignums now too, so that's one more point of failure in this area. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 11:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: eggert@cs.ucla.edu Cc: andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153467838516684 (code B ref 32463); Sun, 19 Aug 2018 11:34:02 +0000 Received: (at 32463) by debbugs.gnu.org; 19 Aug 2018 11:33:05 +0000 Received: from localhost ([127.0.0.1]:54436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLxB-0004L2-56 for submit@debbugs.gnu.org; Sun, 19 Aug 2018 07:33:05 -0400 Received: from mail-lj1-f176.google.com ([209.85.208.176]:44734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frLx9-0004KX-GT for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 07:33:04 -0400 Received: by mail-lj1-f176.google.com with SMTP id q127-v6so9495924ljq.11 for <32463@debbugs.gnu.org>; Sun, 19 Aug 2018 04:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OnMiCO497Fw9mRu3QEaHBZ6+JKK8Ih4ofQesgP/RheI=; b=s+UzPaI/MPqFZDYZmEcZk4WUgXQaZffBxnsf9YSN+MYzo5XCgcrUdVu8hEOFQTdusB 7pu5NYMgaiYgfybOCdZ9Ws59kNedlcRPndBqRkZ4o68zocLZfDC+yRIyXaIkMaRfmTYR ynpTFujs2Sbgl9PRisefbb/PGSNnQLZydc609T5bxpgAe3jt2qdVOi/lJKPQlu8AXGpp x2HOT0xNNI97bVKrNItWi9jYvNu2nQVLvHKJWW2ZE1qW+OhcE5Zys4HXXGp45i2gQrYt c8wPxCcKL/meviFk9wApzxehPBKYjLGzER6wgeNp6HjikvQfPi0tL68ELkGksZKIo2X5 lnwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OnMiCO497Fw9mRu3QEaHBZ6+JKK8Ih4ofQesgP/RheI=; b=tTyecatUhbORXlEVrGQLPaUOzSkvpmL7Q1/3CR5FpJvJtzRHC/OM4Ur4jUwBTfRcjE cckszUstrVkU/LfpIqJizidkRtPx+VmDtFY0LyZihNbYJmtl2/QAHxE5/xtikpMivG8b I25qv7DdPjKxqVAa6VIMMhTNw2k9tatO3+5QrVduFixFMST5mSNJDZW3rmpnIFqAu2rj zHLH1rIn5w3ISLGSsGLMXdxTpICZz3ZqHLPJQ8/Ws2VvncQUXANouT04HgdaICcdtlJX XhpXeQgEON47g1kBealDCYokzkDkYIy1jyCtZp3YCaqa8jyJQjK6FhNoTuB5LQnlQdHN qxPg== X-Gm-Message-State: AOUpUlHx/S2AKHrAKwbujcEYfzSguB7lJ928Qn13/9Wo1UJ008oT71oZ 75FnHuMhPepyusH+t+753jM35LdFb6FjTktGy70= X-Google-Smtp-Source: AA+uWPxEv8+NzNtKsp82GiPOjcz0tMTlTczVcI8xmE8f2lFD6bhHlunJ3Thn/jPy2069ma+Yd6JK5d5fUR1cwzdgS1s= X-Received: by 2002:a2e:712:: with SMTP id 18-v6mr30446243ljh.101.1534678377736; Sun, 19 Aug 2018 04:32:57 -0700 (PDT) MIME-Version: 1.0 References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> In-Reply-To: From: Pip Cet Date: Sun, 19 Aug 2018 11:32:19 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sun, Aug 19, 2018 at 10:59 AM Paul Eggert wrote: > Pip Cet wrote: > > Even if memory isn't exhausted, creating a bignum larger than 16 GB > > (our most-positive-bignum) results in an immediate crash with external > > libgmp (Linux, x86_64), and that appears not to be easy to fix without > > modifying gmp. > > Is there a libgmp bug report for this? or is there a reasonable way to > characterize this arbitrary limitation in libgmp, so that Emacs does not go over > the limit and crash? I've already put in one limit, and we can tighten that > limit (or add more checks) if we know what libgmp's limits are. libgmp stores mpzs as an int (this is a known bug, and plans to work around it are on the GMP site) giving their current size in words (8 bytes each on x86_64). So the maximum bignum is 0x7fffffff * 64 one bits. When that limit is reached, _mpz_realloc calls abort rather than the user-provided reallocation function. Of course, on POSIX systems, we can catch SIGABRT, but then we'd need a flag to mark whether we're in a GMP function and another flag to mark that we're calling abort from a signal handler which might have interrupted the GMP function, and a third flag to mark that stack overflow occurred in a signal handler which interrupted a GMP function so we longjmp()ed out of GMP. On most ELF systems, we can probably preload a library redirecting abort() for GMP. These are all ugly solutions to what is ultimately a GMP limitation that should probably be fixed, making GMP interruptible and abort-safe, which essentially all interactive applications of it require. I think we can be clever and wrap calls to mpz_mul_2exp (which can create arbitrary bignums) and whatever Fexpt uses and make our allocation function signal for bignums >= sqrt(most-positive-bignum) (such numbers cannot produce the overflow condition if combined with multiplication, addition, or subtraction). In fact, I'd suggest a much lower limit until/unless the C-g issue is fixed, perhaps overridable by a user preference if people really want to use big bignums. (I've looked at implementing big rational numbers as an Emacs type using GMP, too, and I think performance issues are more pronounced for those, since even (absolutely) small numbers can have a huge representation.) > > That and left shifts are probably the ones to worry about for now. > > Creating a large bignum by repeated multiplication will require at > > least some intermediate bignums, which need to be allocated and copied > > and thus probably alert the user to something going on. > > expt does bignums now too, so that's one more point of failure in this area. Yes, that's what "that" referred to. Are there other operations that create large bignums that I've missed? I'm not sure what a reasonable limit would be, but I think a global limit of bignum size to something that allows for "immediate" computations would be best. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 15:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: eggert@cs.ucla.edu, andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15346910274302 (code B ref 32463); Sun, 19 Aug 2018 15:04:02 +0000 Received: (at 32463) by debbugs.gnu.org; 19 Aug 2018 15:03:47 +0000 Received: from localhost ([127.0.0.1]:54739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frPF5-00017K-8s for submit@debbugs.gnu.org; Sun, 19 Aug 2018 11:03:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56797) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frPF3-000174-CS for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 11:03:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frPEu-0004Xy-FE for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 11:03:40 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frPEu-0004Xq-2r; Sun, 19 Aug 2018 11:03:36 -0400 Received: from [176.228.60.248] (port=3961 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1frPEt-0000dh-Mm; Sun, 19 Aug 2018 11:03:36 -0400 Date: Sun, 19 Aug 2018 18:03:30 +0300 Message-Id: <831sauflfh.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Pip Cet on Sat, 18 Aug 2018 19:58:40 +0000) References: <86mutll4w2.fsf@gmail.com> <3a6f17af-018e-cb0b-5182-cf736b3a814c@cs.ucla.edu> <83a7pjfql6.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Pip Cet > Date: Sat, 18 Aug 2018 19:58:40 +0000 > Cc: eggert@cs.ucla.edu, andrewjmoreton@gmail.com, 32463@debbugs.gnu.org > > > It is IMO absurd for us to deprecate a valid and useful operation just > > because we added bignums. If we cannot agree on its semantics for > > bignums (which would surprise me), then it is better to make it not > > work for bignums at all than deprecate it for fixnums. > > The recent code changes made `lsh' behave the same as `ash' for > fixnums, if I understand correctly. Are you suggesting we revert to > the previous behavior, and try to come up with an interpretation for > bignums that somehow extends the previous behavior? I indeed missed the change in the behavior of lsh, as it wasn't accompanied by any documentation changes. However, today's commits by Paul already reverted lsh to its previous behavior, I believe. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Aug 2018 18:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153470166525954 (code B ref -1); Sun, 19 Aug 2018 18:02:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Aug 2018 18:01:05 +0000 Received: from localhost ([127.0.0.1]:54799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frS0f-0006kY-Ie for submit@debbugs.gnu.org; Sun, 19 Aug 2018 14:01:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56819) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frS0e-0006jy-Sc for submit@debbugs.gnu.org; Sun, 19 Aug 2018 14:01:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frS0Y-00046R-UA for submit@debbugs.gnu.org; Sun, 19 Aug 2018 14:00:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56598) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frS0Y-00046F-RK for submit@debbugs.gnu.org; Sun, 19 Aug 2018 14:00:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frS0X-0003Wv-Un for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 14:00:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frS0U-000412-0A for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 14:00:57 -0400 Received: from [195.159.176.226] (port=50238 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frS0T-00040c-Q3 for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 14:00:53 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1frRyK-00074V-Al for bug-gnu-emacs@gnu.org; Sun, 19 Aug 2018 19:58:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Sun, 19 Aug 2018 19:00:43 +0100 Lines: 39 Message-ID: <86mutinsms.fsf@gmail.com> References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <66c3b06d-bf67-8f61-4b13-1debf0668010@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:2rTyS6QMXzRkrTqWpYcFTvZmato= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.7 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) On Sun 19 Aug 2018, Paul Eggert wrote: >>> a) A bug in bignumcompare for 64bit Windows. Patch is here: >>> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00487.html >>> ... >>> b) fmod_float has a bug: >>> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00442.html >>> >>> c) Extend Fexpt to support bignums. Patch is here: >>> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00503.html >>> >>> d) Extend Fceiling, Ffloor, Fround and Ftruncate to support bignums by >>>    updating rounding_driver. > > I worked on these and installed patches to master that should do (a), (b), and > (c). For (d) I wrote the attached patch, and plan to test it a bit more before > installing, as it's the hairiest. Thanks for fixing up all of these issues. Hopefully with some added test cases the patch for (d) will also work too. Two more issues: e) Grepping for FIXED_OR_FLOATP shows various places where code either assumes that all types are covered (no longer true now there are bignums), or uses incorrect accessors for the value in the object. For example, Fdefine_coding_system_internal has: else if (FIXED_OR_FLOATP (tmp)) { dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFIXNAT (tmp))); Which should probably be: else if (NUMBERP (tmp)) { dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFLOATINT (tmp))); f) Users of CONS_TO_INTEGER and INTEGER_TO_CONS could be converted to use bignums. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Richard Stallman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Aug 2018 03:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: eggert@cs.ucla.edu, andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Reply-To: rms@gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153473413429420 (code B ref 32463); Mon, 20 Aug 2018 03:03:01 +0000 Received: (at 32463) by debbugs.gnu.org; 20 Aug 2018 03:02:14 +0000 Received: from localhost ([127.0.0.1]:54962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fraSL-0007eR-JZ for submit@debbugs.gnu.org; Sun, 19 Aug 2018 23:02:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58006) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fraSK-0007eE-1V for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 23:02:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fraSD-0006hO-VG for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 23:02:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fraS8-0006ZH-Hv; Sun, 19 Aug 2018 23:02:00 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1fraS8-0003CD-CX; Sun, 19 Aug 2018 23:02:00 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman In-Reply-To: (message from Pip Cet on Fri, 17 Aug 2018 11:36:06 +0000) References: <86mutll4w2.fsf@gmail.com> Message-Id: Date: Sun, 19 Aug 2018 23:02:00 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] What exactly is the problem with lsh and bignums? Is it for negative numbers because there is no specific width? I think that limiting lsh to fixnums is better than altering its behavior for fixnums. But there are other solutions. One possible solution is to give lsh an optional third argument to specify the nominal width of the first argument. The default could be the width of a fixnum on your platform. How does Scheme handle the issue? -- Dr Richard Stallman President, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Aug 2018 03:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: rms@gnu.org, Pip Cet Cc: andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15347368591234 (code B ref 32463); Mon, 20 Aug 2018 03:48:02 +0000 Received: (at 32463) by debbugs.gnu.org; 20 Aug 2018 03:47:39 +0000 Received: from localhost ([127.0.0.1]:54984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frbAJ-0000Jq-23 for submit@debbugs.gnu.org; Sun, 19 Aug 2018 23:47:39 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41402) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frbAH-0000Jd-OX for 32463@debbugs.gnu.org; Sun, 19 Aug 2018 23:47:38 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 03BC616087B; Sun, 19 Aug 2018 20:47:31 -0700 (PDT) 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 PHsONWVmN16i; Sun, 19 Aug 2018 20:47:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3EBAC160885; Sun, 19 Aug 2018 20:47:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 BQUvugNjhqW2; Sun, 19 Aug 2018 20:47:30 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id BEFDB16087B; Sun, 19 Aug 2018 20:47:29 -0700 (PDT) References: <86mutll4w2.fsf@gmail.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sun, 19 Aug 2018 20:47:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Richard Stallman wrote: > What exactly is the problem with lsh and bignums? Is it for negative > numbers because there is no specific width? Yes, that's it. > One possible solution is to give lsh an optional third argument to > specify the nominal width of the first argument. The default could be > the width of a fixnum on your platform. Although we discussed something along those lines and could easily implement something, it's a bit trickier than it might sound at first, because of corner cases where the semantics are unclear. Here's one possible implementation (there are other approaches of course): (defun lsh (value count &optional width) (when (and (< value 0) (< count 0)) (let ((lo (if width (ash 1 (1- width)) most-negative-fixnum))) (when (< value lo) (signal 'args-out-of-range (list value count width))) (setq value (logand (ash value -1) (- -1 lo))) (setq count (1+ count)))) (ash value count)) I am skeptical whether the complexity of this extension is worth the effort to maintain and document. In a language with bignums, if you need a mask of bits you simply use a nonnegative integer, which means you can use ash without worrying about the corner cases that invariably afflict lsh. > How does Scheme handle the issue? Scheme does not have logical shifts, only arithmetic shifts. Logical shifts don't make that much sense once you have bignums. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Richard Stallman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Aug 2018 03:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: andrewjmoreton@gmail.com, pipcet@gmail.com, 32463@debbugs.gnu.org Reply-To: rms@gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153482265826351 (code B ref 32463); Tue, 21 Aug 2018 03:38:02 +0000 Received: (at 32463) by debbugs.gnu.org; 21 Aug 2018 03:37:38 +0000 Received: from localhost ([127.0.0.1]:56091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frxUA-0006qx-GD for submit@debbugs.gnu.org; Mon, 20 Aug 2018 23:37:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frxU9-0006qi-6U for 32463@debbugs.gnu.org; Mon, 20 Aug 2018 23:37:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frxU3-0008UF-1e for 32463@debbugs.gnu.org; Mon, 20 Aug 2018 23:37:31 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frxTw-0008NW-21; Mon, 20 Aug 2018 23:37:24 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1frxTv-0003YN-Ur; Mon, 20 Aug 2018 23:37:23 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman In-Reply-To: (message from Paul Eggert on Sun, 19 Aug 2018 20:47:29 -0700) References: <86mutll4w2.fsf@gmail.com> Message-Id: Date: Mon, 20 Aug 2018 23:37:23 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] Maybe you are right about lsh and bignums, but we must keep lsh for fixnums compatibility. It could give an error if the first argument is a negative bignum. Or it could give an error for any bignum. -- Dr Richard Stallman President, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Aug 2018 09:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153484444830226 (code B ref 32463); Tue, 21 Aug 2018 09:41:01 +0000 Received: (at 32463) by debbugs.gnu.org; 21 Aug 2018 09:40:48 +0000 Received: from localhost ([127.0.0.1]:56155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fs39b-0007rQ-3J for submit@debbugs.gnu.org; Tue, 21 Aug 2018 05:40:48 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:45778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fs39Y-0007rB-2c for 32463@debbugs.gnu.org; Tue, 21 Aug 2018 05:40:45 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 148F11600CC; Tue, 21 Aug 2018 02:40:38 -0700 (PDT) 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 1GC6gHTEBxWz; Tue, 21 Aug 2018 02:40:35 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 71451160192; Tue, 21 Aug 2018 02:40:35 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 OZ8peec1XvAV; Tue, 21 Aug 2018 02:40:35 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id EAB921600CC; Tue, 21 Aug 2018 02:40:34 -0700 (PDT) References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <7b6c9c32-c301-09db-d23e-ce976afcb5c1@cs.ucla.edu> Date: Tue, 21 Aug 2018 02:40:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------F280AC23312D69F6EF729036" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------F280AC23312D69F6EF729036 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Pip Cet wrote: > I think we can be clever and wrap calls to mpz_mul_2exp (which can > create arbitrary bignums) and whatever Fexpt uses.... I'd suggest a mu= ch > lower limit until/unless the C-g issue is fixed, perhaps overridable > by a user preference if people really want to use big bignums. Yes, this sounds good. After stressing Emacs with bignums for a bit, I fo= und=20 that it was too easy to get Emacs to abort or hang by creating large bign= ums. > I'm not sure what a reasonable limit would be, but I think a global > limit of bignum size to something that allows for "immediate" > computations would be best. I installed the attached patch to do that. It tentatively defaults to a l= imit of=20 2=E2=86=91=E2=86=915 (i.e., 2**65536) for bignums, overrideable by settin= g a new variable=20 'integer-width' that defaults to 65536. This default should be big enough= for=20 almost all Emacs applications and should avoid issues of aborts and hangs= . --------------F280AC23312D69F6EF729036 Content-Type: text/x-patch; name="0001-Avoid-libgmp-aborts-by-imposing-limits.patch" Content-Disposition: attachment; filename="0001-Avoid-libgmp-aborts-by-imposing-limits.patch" Content-Transfer-Encoding: quoted-printable >From d6a497dd887cdbb35c5b4e2929e83962ba708159 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 21 Aug 2018 02:16:50 -0700 Subject: [PATCH] Avoid libgmp aborts by imposing limits MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit libgmp calls =E2=80=98abort=E2=80=99 when given numbers too big for its internal data structures. The numeric limit is large and platform-dependent; with 64-bit GMP 6.1.2 it is around 2**2**37. Work around the problem by refusing to call libgmp functions with arguments that would cause an abort. With luck libgmp will have a better way to do this in the future. Also, introduce a variable integer-width that lets the user control how large bignums can be. This currently defaults to 2**16, i.e., it allows bignums up to 2**2**16. This should be enough for ordinary computation, and should help Emacs to avoid thrashing or hanging. Problem noted by Pip Cet (Bug#32463#71). * doc/lispref/numbers.texi, etc/NEWS: Document recent bignum changes, including this one. Improve documentation for bitwise operations, in the light of bignums. * src/alloc.c (make_number): Enforce integer-width. (integer_overflow): New function. (xrealloc_for_gmp, xfree_for_gmp): Move here from emacs.c, as it's memory allocation. (init_alloc): Initialize GMP here, rather than in emacs.c. (integer_width): New var. * src/data.c (GMP_NLIMBS_MAX, NLIMBS_LIMIT): New constants. (emacs_mpz_size, emacs_mpz_mul) (emacs_mpz_mul_2exp, emacs_mpz_pow_ui): New functions. (arith_driver, Fash, expt_integer): Use them. (expt_integer): New function, containing integer code that was out of place in floatfns.c. (check_bignum_size, xmalloc_for_gmp): Remove. * src/emacs.c (main): Do not initialize GMP here. * src/floatfns.c (Fexpt): Use expt_integer, which now contains integer code moved from here. * src/lisp.h (GMP_NUMB_BITS): Define if gmp.h doesn=E2=80=99t. --- doc/lispref/numbers.texi | 314 ++++++++++++++++++--------------------- etc/NEWS | 6 + src/alloc.c | 73 ++++++--- src/data.c | 109 +++++++++++++- src/emacs.c | 34 ----- src/floatfns.c | 24 +-- src/lisp.h | 11 +- 7 files changed, 321 insertions(+), 250 deletions(-) diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index 209e9f139a..9c16b1a64c 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi @@ -34,13 +34,21 @@ Numbers @node Integer Basics @section Integer Basics =20 - Integers in Emacs Lisp can have arbitrary precision. + Integers in Emacs Lisp are not limited to the machine word size. =20 Under the hood, though, there are two kinds of integers: smaller ones, called @dfn{fixnums}, and larger ones, called @dfn{bignums}. -Some functions in Emacs only accept fixnums. Also, while fixnums can -always be compared for equality with @code{eq}, bignums require the -use of @code{eql}. +Some functions in Emacs accept only fixnums. Also, while fixnums can +always be compared for numeric equality with @code{eq}, bignums +require more-heavyweight equality predicates like @code{eql}. + + The range of values for bignums is limited by the amount of main +memory, by machine characteristics such as the size of the word used +to represent a bignum's exponent, and by the @code{integer-width} +variable. These limits are typically much more generous than the +limits for fixnums. A bignum is never numerically equal to a fixnum; +if Emacs computes an integer in fixnum range, it represents the +integer as a fixnum, not a bignum. =20 The range of values for a fixnum depends on the machine. The minimum range is @minus{}536,870,912 to 536,870,911 (30 bits; i.e., @@ -97,33 +105,30 @@ Integer Basics #24r1k @result{} 44 @end example =20 - An integer is read as a fixnum if it is in the correct range. -Otherwise, it will be read as a bignum. - To understand how various functions work on integers, especially the bitwise operators (@pxref{Bitwise Operations}), it is often helpful to view the numbers in their binary form. =20 - In 30-bit binary, the decimal integer 5 looks like this: + In binary, the decimal integer 5 looks like this: =20 @example -0000...000101 (30 bits total) +...000101 @end example =20 @noindent -(The @samp{...} stands for enough bits to fill out a 30-bit word; in -this case, @samp{...} stands for twenty 0 bits. Later examples also -use the @samp{...} notation to make binary integers easier to read.) +(The @samp{...} stands for a conceptually infinite number of bits that +match the leading bit; here, an infinite number of 0 bits. Later +examples also use this @samp{...} notation.) =20 The integer @minus{}1 looks like this: =20 @example -1111...111111 (30 bits total) +...111111 @end example =20 @noindent @cindex two's complement -@minus{}1 is represented as 30 ones. (This is called @dfn{two's +@minus{}1 is represented as all ones. (This is called @dfn{two's complement} notation.) =20 Subtracting 4 from @minus{}1 returns the negative integer @minus{}5. @@ -131,14 +136,7 @@ Integer Basics @minus{}5 looks like this: =20 @example -1111...111011 (30 bits total) -@end example - - In this implementation, the largest 30-bit binary integer is -536,870,911 in decimal. In binary, it looks like this: - -@example -0111...111111 (30 bits total) +...111011 @end example =20 Many of the functions described in this chapter accept markers for @@ -147,10 +145,10 @@ Integer Basics give these arguments the name @var{number-or-marker}. When the argument value is a marker, its position value is used and its buffer is ignored. =20 -@cindex largest Lisp integer -@cindex maximum Lisp integer +@cindex largest fixnum +@cindex maximum fixnum @defvar most-positive-fixnum -The value of this variable is the largest ``small'' integer that Emacs +The value of this variable is the greatest ``small'' integer that Emacs Lisp can handle. Typical values are @ifnottex 2**29 @minus{} 1 @@ -168,11 +166,11 @@ Integer Basics on 64-bit platforms. @end defvar =20 -@cindex smallest Lisp integer -@cindex minimum Lisp integer +@cindex smallest fixnum +@cindex minimum fixnum @defvar most-negative-fixnum -The value of this variable is the smallest small integer that Emacs -Lisp can handle. It is negative. Typical values are +The value of this variable is the numerically least ``small'' integer +that Emacs Lisp can handle. It is negative. Typical values are @ifnottex @minus{}2**29 @end ifnottex @@ -187,6 +185,19 @@ Integer Basics @math{-2^{61}} @end tex on 64-bit platforms. +@end defvar + +@cindex bignum range +@cindex integer range +@defvar integer-width +The value of this variable is a nonnegative integer that is an upper +bound on the number of bits in a bignum. Integers outside the fixnum +range are limited to absolute values less than 2@sup{@var{n}}, where +@var{n} is this variable's value. Attempts to create bignums outside +this range result in integer overflow. Setting this variable to zero +disables creation of bignums; setting it to a large number can cause +Emacs to consume large quantities of memory if a computation creates +huge integers. @end defvar =20 In Emacs Lisp, text characters are represented by integers. Any @@ -378,17 +389,17 @@ Comparison of Numbers comparison would return @code{nil} and vice versa. @xref{Float Basics}. =20 - In Emacs Lisp, each small integer is a unique Lisp object. -Therefore, @code{eq} is equivalent to @code{=3D} where small integers ar= e -concerned. It is sometimes convenient to use @code{eq} for comparing -an unknown value with an integer, because @code{eq} does not report an + In Emacs Lisp, if two fixnums are numerically equal, they are the +same Lisp object. That is, @code{eq} is equivalent to @code{=3D} on +fixnums. It is sometimes convenient to use @code{eq} for comparing +an unknown value with a fixnum, because @code{eq} does not report an error if the unknown value is not a number---it accepts arguments of any type. By contrast, @code{=3D} signals an error if the arguments are not numbers or markers. However, it is better programming practice to use @code{=3D} if you can, even for comparing integers. =20 - Sometimes it is useful to compare numbers with @code{equal}, which -treats two numbers as equal if they have the same data type (both + Sometimes it is useful to compare numbers with @code{eql} or @code{equ= al}, +which treat two numbers as equal if they have the same data type (both integers, or both floating point) and the same value. By contrast, @code{=3D} can treat an integer and a floating-point number as equal. @xref{Equality Predicates}. @@ -830,142 +841,113 @@ Bitwise Operations @cindex logical arithmetic =20 In a computer, an integer is represented as a binary number, a -sequence of @dfn{bits} (digits which are either zero or one). A bitwise +sequence of @dfn{bits} (digits which are either zero or one). +Conceptually the bit sequence is infinite on the left, with the +most-significant bits being all zeros or all ones. A bitwise operation acts on the individual bits of such a sequence. For example, @dfn{shifting} moves the whole sequence left or right one or more places= , reproducing the same pattern moved over. =20 The bitwise operations in Emacs Lisp apply only to integers. =20 -@defun lsh integer1 count -@cindex logical shift -@code{lsh}, which is an abbreviation for @dfn{logical shift}, shifts the -bits in @var{integer1} to the left @var{count} places, or to the right -if @var{count} is negative, bringing zeros into the vacated bits. If -@var{count} is negative, @code{lsh} shifts zeros into the leftmost -(most-significant) bit, producing a nonnegative result even if -@var{integer1} is negative fixnum. (If @var{integer1} is a negative -bignum, @var{count} must be nonnegative.) Contrast this with -@code{ash}, below. - -Here are two examples of @code{lsh}, shifting a pattern of bits one -place to the left. We show only the low-order eight bits of the binary -pattern; the rest are all zero. +@defun ash integer1 count +@cindex arithmetic shift +@code{ash} (@dfn{arithmetic shift}) shifts the bits in @var{integer1} +to the left @var{count} places, or to the right if @var{count} is +negative. Left shifts introduce zero bits on the right; right shifts +discard the rightmost bits. Considered as an integer operation, +@code{ash} multiplies @var{integer1} by 2@sup{@var{count}} and then +converts the result to an integer by rounding downward, toward +minus infinity. + +Here are examples of @code{ash}, shifting a pattern of bits one place +to the left and to the right. These examples show only the low-order +bits of the binary pattern; leading bits all agree with the +highest-order bit shown. As you can see, shifting left by one is +equivalent to multiplying by two, whereas shifting right by one is +equivalent to dividing by two and then rounding toward minus infinity. =20 @example @group -(lsh 5 1) - @result{} 10 -;; @r{Decimal 5 becomes decimal 10.} -00000101 @result{} 00001010 - -(lsh 7 1) - @result{} 14 +(ash 7 1) @result{} 14 ;; @r{Decimal 7 becomes decimal 14.} -00000111 @result{} 00001110 -@end group -@end example - -@noindent -As the examples illustrate, shifting the pattern of bits one place to -the left produces a number that is twice the value of the previous -number. - -Shifting a pattern of bits two places to the left produces results -like this (with 8-bit binary numbers): - -@example -@group -(lsh 3 2) - @result{} 12 -;; @r{Decimal 3 becomes decimal 12.} -00000011 @result{} 00001100 +...000111 + @result{} +...001110 @end group -@end example - -On the other hand, shifting one place to the right looks like this: =20 -@example @group -(lsh 6 -1) - @result{} 3 -;; @r{Decimal 6 becomes decimal 3.} -00000110 @result{} 00000011 +(ash 7 -1) @result{} 3 +...000111 + @result{} +...000011 @end group =20 @group -(lsh 5 -1) - @result{} 2 -;; @r{Decimal 5 becomes decimal 2.} -00000101 @result{} 00000010 +(ash -7 1) @result{} -14 +...111001 + @result{} +...110010 @end group -@end example - -@noindent -As the example illustrates, shifting one place to the right divides the -value of a positive integer by two, rounding downward. -@end defun - -@defun ash integer1 count -@cindex arithmetic shift -@code{ash} (@dfn{arithmetic shift}) shifts the bits in @var{integer1} -to the left @var{count} places, or to the right if @var{count} -is negative. - -@code{ash} gives the same results as @code{lsh} except when -@var{integer1} and @var{count} are both negative. In that case, -@code{ash} puts ones in the empty bit positions on the left, while -@code{lsh} puts zeros in those bit positions and requires -@var{integer1} to be a fixnum. =20 -Thus, with @code{ash}, shifting the pattern of bits one place to the rig= ht -looks like this: - -@example @group -(ash -6 -1) @result{} -3 -;; @r{Decimal @minus{}6 becomes decimal @minus{}3.} -1111...111010 (30 bits total) +(ash -7 -1) @result{} -4 +...111001 @result{} -1111...111101 (30 bits total) +...111100 @end group @end example =20 -Here are other examples: +Here are examples of shifting left or right by two bits: =20 -@c !!! Check if lined up in smallbook format! XDVI shows problem -@c with smallbook but not with regular book! --rjc 16mar92 @smallexample @group - ; @r{ 30-bit binary values} - -(lsh 5 2) ; 5 =3D @r{0000...000101} - @result{} 20 ; =3D @r{0000...010100} -@end group -@group -(ash 5 2) - @result{} 20 -(lsh -5 2) ; -5 =3D @r{1111...111011} - @result{} -20 ; =3D @r{1111...101100} -(ash -5 2) - @result{} -20 + ; @r{ binary values} +(ash 5 2) ; 5 =3D @r{...000101} + @result{} 20 ; =3D @r{...010100} +(ash -5 2) ; -5 =3D @r{...111011} + @result{} -20 ; =3D @r{...101100} @end group @group -(lsh 5 -2) ; 5 =3D @r{0000...000101} - @result{} 1 ; =3D @r{0000...000001} +(ash 5 -2) + @result{} 1 ; =3D @r{...000001} @end group @group -(ash 5 -2) - @result{} 1 +(ash -5 -2) + @result{} -2 ; =3D @r{...111110} @end group +@end smallexample +@end defun + +@defun lsh integer1 count +@cindex logical shift +@code{lsh}, which is an abbreviation for @dfn{logical shift}, shifts the +bits in @var{integer1} to the left @var{count} places, or to the right +if @var{count} is negative, bringing zeros into the vacated bits. If +@var{count} is negative, then @var{integer1} must be either a fixnum +or a positive bignum, and @code{lsh} treats a negative fixnum as if it +were unsigned by subtracting twice @code{most-negative-fixnum} before +shifting, producing a nonnegative result. This quirky behavior dates +back to when Emacs supported only fixnums; nowadays @code{ash} is a +better choice. + +As @code{lsh} behaves like @code{ash} except when @var{integer1} and +@var{count1} are both negative, the following examples focus on these +exceptional cases. These examples assume 30-bit fixnums. + +@smallexample @group -(lsh -5 -2) ; -5 =3D @r{1111...111011} - @result{} 268435454 - ; =3D @r{0011...111110} + ; @r{ binary values} +(ash -7 -1) ; -7 =3D @r{...111111111111111111111111111001} + @result{} -4 ; =3D @r{...111111111111111111111111111100} +(lsh -7 -1) + @result{} 536870908 ; =3D @r{...011111111111111111111111111100} @end group @group -(ash -5 -2) ; -5 =3D @r{1111...111011} - @result{} -2 ; =3D @r{1111...111110} +(ash -5 -2) ; -5 =3D @r{...111111111111111111111111111011} + @result{} -2 ; =3D @r{...111111111111111111111111111110} +(lsh -5 -2) + @result{} 268435454 ; =3D @r{...001111111111111111111111111110} @end group @end smallexample @end defun @@ -999,23 +981,23 @@ Bitwise Operations =20 @smallexample @group - ; @r{ 30-bit binary values} + ; @r{ binary values} =20 -(logand 14 13) ; 14 =3D @r{0000...001110} - ; 13 =3D @r{0000...001101} - @result{} 12 ; 12 =3D @r{0000...001100} +(logand 14 13) ; 14 =3D @r{...001110} + ; 13 =3D @r{...001101} + @result{} 12 ; 12 =3D @r{...001100} @end group =20 @group -(logand 14 13 4) ; 14 =3D @r{0000...001110} - ; 13 =3D @r{0000...001101} - ; 4 =3D @r{0000...000100} - @result{} 4 ; 4 =3D @r{0000...000100} +(logand 14 13 4) ; 14 =3D @r{...001110} + ; 13 =3D @r{...001101} + ; 4 =3D @r{...000100} + @result{} 4 ; 4 =3D @r{...000100} @end group =20 @group (logand) - @result{} -1 ; -1 =3D @r{1111...111111} + @result{} -1 ; -1 =3D @r{...111111} @end group @end smallexample @end defun @@ -1029,18 +1011,18 @@ Bitwise Operations =20 @smallexample @group - ; @r{ 30-bit binary values} + ; @r{ binary values} =20 -(logior 12 5) ; 12 =3D @r{0000...001100} - ; 5 =3D @r{0000...000101} - @result{} 13 ; 13 =3D @r{0000...001101} +(logior 12 5) ; 12 =3D @r{...001100} + ; 5 =3D @r{...000101} + @result{} 13 ; 13 =3D @r{...001101} @end group =20 @group -(logior 12 5 7) ; 12 =3D @r{0000...001100} - ; 5 =3D @r{0000...000101} - ; 7 =3D @r{0000...000111} - @result{} 15 ; 15 =3D @r{0000...001111} +(logior 12 5 7) ; 12 =3D @r{...001100} + ; 5 =3D @r{...000101} + ; 7 =3D @r{...000111} + @result{} 15 ; 15 =3D @r{...001111} @end group @end smallexample @end defun @@ -1054,18 +1036,18 @@ Bitwise Operations =20 @smallexample @group - ; @r{ 30-bit binary values} + ; @r{ binary values} =20 -(logxor 12 5) ; 12 =3D @r{0000...001100} - ; 5 =3D @r{0000...000101} - @result{} 9 ; 9 =3D @r{0000...001001} +(logxor 12 5) ; 12 =3D @r{...001100} + ; 5 =3D @r{...000101} + @result{} 9 ; 9 =3D @r{...001001} @end group =20 @group -(logxor 12 5 7) ; 12 =3D @r{0000...001100} - ; 5 =3D @r{0000...000101} - ; 7 =3D @r{0000...000111} - @result{} 14 ; 14 =3D @r{0000...001110} +(logxor 12 5 7) ; 12 =3D @r{...001100} + ; 5 =3D @r{...000101} + ; 7 =3D @r{...000111} + @result{} 14 ; 14 =3D @r{...001110} @end group @end smallexample @end defun @@ -1078,9 +1060,9 @@ Bitwise Operations @example (lognot 5) @result{} -6 -;; 5 =3D @r{0000...000101} (30 bits total) +;; 5 =3D @r{...000101} ;; @r{becomes} -;; -6 =3D @r{1111...111010} (30 bits total) +;; -6 =3D @r{...111010} @end example @end defun =20 @@ -1095,9 +1077,9 @@ Bitwise Operations nonnegative. =20 @example -(logcount 43) ; 43 =3D #b101011 +(logcount 43) ; 43 =3D @r{...000101011} @result{} 4 -(logcount -43) ; -43 =3D #b111...1010101 +(logcount -43) ; -43 =3D @r{...111010101} @result{} 3 @end example @end defun diff --git a/etc/NEWS b/etc/NEWS index a9f8ed2ef8..9a74164421 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -871,6 +871,12 @@ bignums. However, note that unlike fixnums, bignums= will not compare equal with 'eq', you must use 'eql' instead. (Numerical comparison with '=3D' works on both, of course.) =20 ++++ +** New variable 'integer-width'. +It is a nonnegative integer specifying the maximum number of bits +allowed in a bignum. Integer overflow occurs if this limit is +exceeded. + ** define-minor-mode automatically documents the meaning of ARG =20 +++ diff --git a/src/alloc.c b/src/alloc.c index ddc0696ba9..24a24aab96 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3746,33 +3746,33 @@ make_bignum_str (const char *num, int base) Lisp_Object make_number (mpz_t value) { - if (mpz_fits_slong_p (value)) - { - long l =3D mpz_get_si (value); - if (!FIXNUM_OVERFLOW_P (l)) - return make_fixnum (l); - } - else if (LONG_WIDTH < FIXNUM_BITS) + size_t bits =3D mpz_sizeinbase (value, 2); + + if (bits <=3D FIXNUM_BITS) { - size_t bits =3D mpz_sizeinbase (value, 2); + EMACS_INT v =3D 0; + int i =3D 0, shift =3D 0; =20 - if (bits <=3D FIXNUM_BITS) - { - EMACS_INT v =3D 0; - int i =3D 0; - for (int shift =3D 0; shift < bits; shift +=3D mp_bits_per_limb) - { - EMACS_INT limb =3D mpz_getlimbn (value, i++); - v +=3D limb << shift; - } - if (mpz_sgn (value) < 0) - v =3D -v; + do + { + EMACS_INT limb =3D mpz_getlimbn (value, i++); + v +=3D limb << shift; + shift +=3D GMP_NUMB_BITS; + } + while (shift < bits); =20 - if (!FIXNUM_OVERFLOW_P (v)) - return make_fixnum (v); - } + if (mpz_sgn (value) < 0) + v =3D -v; + + if (!FIXNUM_OVERFLOW_P (v)) + return make_fixnum (v); } =20 + /* The documentation says integer-width should be nonnegative, so + a single comparison suffices even though 'bits' is unsigned. */ + if (integer_width < bits) + integer_overflow (); + struct Lisp_Bignum *b =3D ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, v= alue, PVEC_BIGNUM); /* We could mpz_init + mpz_swap here, to avoid a copy, but the @@ -7200,6 +7200,26 @@ verify_alloca (void) =20 #endif /* ENABLE_CHECKING && USE_STACK_LISP_OBJECTS */ =20 +/* Memory allocation for GMP. */ + +void +integer_overflow (void) +{ + error ("Integer too large to be represented"); +} + +static void * +xrealloc_for_gmp (void *ptr, size_t ignore, size_t size) +{ + return xrealloc (ptr, size); +} + +static void +xfree_for_gmp (void *ptr, size_t ignore) +{ + xfree (ptr); +} + /* Initialization. */ =20 void @@ -7233,6 +7253,10 @@ init_alloc_once (void) void init_alloc (void) { + eassert (mp_bits_per_limb =3D=3D GMP_NUMB_BITS); + integer_width =3D 1 << 16; + mp_set_memory_functions (xmalloc, xrealloc_for_gmp, xfree_for_gmp); + Vgc_elapsed =3D make_float (0.0); gcs_done =3D 0; =20 @@ -7335,6 +7359,11 @@ The time is in seconds as a floating point value. = */); DEFVAR_INT ("gcs-done", gcs_done, doc: /* Accumulated number of garbage collections done. *= /); =20 + DEFVAR_INT ("integer-width", integer_width, + doc: /* Maximum number of bits in bignums. +Integers outside the fixnum range are limited to absolute values less +than 2**N, where N is this variable's value. N should be nonnegative. = */); + defsubr (&Scons); defsubr (&Slist); defsubr (&Svector); diff --git a/src/data.c b/src/data.c index 8a6975da3a..4c6d33f294 100644 --- a/src/data.c +++ b/src/data.c @@ -2384,6 +2384,80 @@ bool-vector. IDX starts at 0. */) return newelt; } =0C +/* GMP tests for this value and aborts (!) if it is exceeded. + This is as of GMP 6.1.2 (2016); perhaps future versions will differ. = */ +enum { GMP_NLIMBS_MAX =3D min (INT_MAX, ULONG_MAX / GMP_NUMB_BITS) }; + +/* An upper bound on limb counts, needed to prevent libgmp and/or + Emacs from aborting or otherwise misbehaving. This bound applies + to estimates of mpz_t sizes before the mpz_t objects are created, + as opposed to integer-width which operates on mpz_t values after + creation and before conversion to Lisp bignums. */ +enum + { + NLIMBS_LIMIT =3D min (min (/* libgmp needs to store limb counts. */ + GMP_NLIMBS_MAX, + + /* Size calculations need to work. */ + min (PTRDIFF_MAX, SIZE_MAX) / sizeof (mp_limb_t)), + + /* Emacs puts bit counts into fixnums. */ + MOST_POSITIVE_FIXNUM / GMP_NUMB_BITS) + }; + +/* Like mpz_size, but tell the compiler the result is a nonnegative int.= */ + +static int +emacs_mpz_size (mpz_t const op) +{ + mp_size_t size =3D mpz_size (op); + eassume (0 <=3D size && size <=3D INT_MAX); + return size; +} + +/* Wrappers to work around GMP limitations. As of GMP 6.1.2 (2016), + the library code aborts when a number is too large. These wrappers + avoid the problem for functions that can return numbers much larger + than their arguments. For slowly-growing numbers, the integer + width check in make_number should suffice. */ + +static void +emacs_mpz_mul (mpz_t rop, mpz_t const op1, mpz_t const op2) +{ + if (NLIMBS_LIMIT - emacs_mpz_size (op1) < emacs_mpz_size (op2)) + integer_overflow (); + mpz_mul (rop, op1, op2); +} + +static void +emacs_mpz_mul_2exp (mpz_t rop, mpz_t const op1, mp_bitcnt_t op2) +{ + /* Fudge factor derived from GMP 6.1.2, to avoid an abort in + mpz_mul_2exp (look for the '+ 1' in its source code). */ + enum { mul_2exp_extra_limbs =3D 1 }; + enum { lim =3D min (NLIMBS_LIMIT, GMP_NLIMBS_MAX - mul_2exp_extra_limb= s) }; + + mp_bitcnt_t op2limbs =3D op2 / GMP_NUMB_BITS; + if (lim - emacs_mpz_size (op1) < op2limbs) + integer_overflow (); + mpz_mul_2exp (rop, op1, op2); +} + +static void +emacs_mpz_pow_ui (mpz_t rop, mpz_t const base, unsigned long exp) +{ + /* This fudge factor is derived from GMP 6.1.2, to avoid an abort in + mpz_n_pow_ui (look for the '5' in its source code). */ + enum { pow_ui_extra_limbs =3D 5 }; + enum { lim =3D min (NLIMBS_LIMIT, GMP_NLIMBS_MAX - pow_ui_extra_limbs)= }; + + int nbase =3D emacs_mpz_size (base), n; + if (INT_MULTIPLY_WRAPV (nbase, exp, &n) || lim < n) + integer_overflow (); + mpz_pow_ui (rop, base, exp); +} + +=0C /* Arithmetic functions */ =20 Lisp_Object @@ -2872,13 +2946,13 @@ arith_driver (enum arithop code, ptrdiff_t nargs,= Lisp_Object *args) break; case Amult: if (BIGNUMP (val)) - mpz_mul (accum, accum, XBIGNUM (val)->value); + emacs_mpz_mul (accum, accum, XBIGNUM (val)->value); else if (! FIXNUMS_FIT_IN_LONG) { mpz_t tem; mpz_init (tem); mpz_set_intmax (tem, XFIXNUM (val)); - mpz_mul (accum, accum, tem); + emacs_mpz_mul (accum, accum, tem); mpz_clear (tem); } else @@ -3293,7 +3367,7 @@ In this case, the sign bit is duplicated. */) mpz_t result; mpz_init (result); if (XFIXNUM (count) > 0) - mpz_mul_2exp (result, XBIGNUM (value)->value, XFIXNUM (count)); + emacs_mpz_mul_2exp (result, XBIGNUM (value)->value, XFIXNUM (count)); else mpz_fdiv_q_2exp (result, XBIGNUM (value)->value, - XFIXNUM (count)); val =3D make_number (result); @@ -3319,7 +3393,7 @@ In this case, the sign bit is duplicated. */) mpz_set_intmax (result, XFIXNUM (value)); =20 if (XFIXNUM (count) >=3D 0) - mpz_mul_2exp (result, result, XFIXNUM (count)); + emacs_mpz_mul_2exp (result, result, XFIXNUM (count)); else mpz_fdiv_q_2exp (result, result, - XFIXNUM (count)); =20 @@ -3330,6 +3404,33 @@ In this case, the sign bit is duplicated. */) return val; } =20 +/* Return X ** Y as an integer. X and Y must be integers, and Y must + be nonnegative. */ + +Lisp_Object +expt_integer (Lisp_Object x, Lisp_Object y) +{ + unsigned long exp; + if (TYPE_RANGED_FIXNUMP (unsigned long, y)) + exp =3D XFIXNUM (y); + else if (MOST_POSITIVE_FIXNUM < ULONG_MAX && BIGNUMP (y) + && mpz_fits_ulong_p (XBIGNUM (y)->value)) + exp =3D mpz_get_ui (XBIGNUM (y)->value); + else + integer_overflow (); + + mpz_t val; + mpz_init (val); + emacs_mpz_pow_ui (val, + (FIXNUMP (x) + ? (mpz_set_intmax (val, XFIXNUM (x)), val) + : XBIGNUM (x)->value), + exp); + Lisp_Object res =3D make_number (val); + mpz_clear (val); + return res; +} + DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0, doc: /* Return NUMBER plus one. NUMBER may be a number or a mark= er. Markers are converted to integers. */) diff --git a/src/emacs.c b/src/emacs.c index 11ee0b8118..7d07ec8502 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -673,38 +673,6 @@ close_output_streams (void) _exit (EXIT_FAILURE); } =20 -/* Memory allocation functions for GMP. */ - -static void -check_bignum_size (size_t size) -{ - /* Do not create a bignum whose log base 2 could exceed fixnum range. - This way, functions like mpz_popcount return values in fixnum range= . - It may also help to avoid other problems with outlandish bignums. = */ - if (MOST_POSITIVE_FIXNUM / CHAR_BIT < size) - error ("Integer too large to be represented"); -} - -static void * ATTRIBUTE_MALLOC -xmalloc_for_gmp (size_t size) -{ - check_bignum_size (size); - return xmalloc (size); -} - -static void * -xrealloc_for_gmp (void *ptr, size_t ignore, size_t size) -{ - check_bignum_size (size); - return xrealloc (ptr, size); -} - -static void -xfree_for_gmp (void *ptr, size_t ignore) -{ - xfree (ptr); -} - /* ARGSUSED */ int main (int argc, char **argv) @@ -803,8 +771,6 @@ main (int argc, char **argv) init_standard_fds (); atexit (close_output_streams); =20 - mp_set_memory_functions (xmalloc_for_gmp, xrealloc_for_gmp, xfree_for_= gmp); - sort_args (argc, argv); argc =3D 0; while (argv[argc]) argc++; diff --git a/src/floatfns.c b/src/floatfns.c index 7c52a0a9a2..ea9000b90a 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -210,29 +210,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, /* Common Lisp spec: don't promote if both are integers, and if the result is not fractional. */ if (INTEGERP (arg1) && NATNUMP (arg2)) - { - unsigned long exp; - if (TYPE_RANGED_FIXNUMP (unsigned long, arg2)) - exp =3D XFIXNUM (arg2); - else if (MOST_POSITIVE_FIXNUM < ULONG_MAX && BIGNUMP (arg2) - && mpz_fits_ulong_p (XBIGNUM (arg2)->value)) - exp =3D mpz_get_ui (XBIGNUM (arg2)->value); - else - xsignal3 (Qrange_error, build_string ("expt"), arg1, arg2); - - mpz_t val; - mpz_init (val); - if (FIXNUMP (arg1)) - { - mpz_set_intmax (val, XFIXNUM (arg1)); - mpz_pow_ui (val, val, exp); - } - else - mpz_pow_ui (val, XBIGNUM (arg1)->value, exp); - Lisp_Object res =3D make_number (val); - mpz_clear (val); - return res; - } + return expt_integer (arg1, arg2); =20 return make_float (pow (XFLOATINT (arg1), XFLOATINT (arg2))); } diff --git a/src/lisp.h b/src/lisp.h index fe384d1844..8f48a33484 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -996,6 +996,14 @@ enum More_Lisp_Bits #define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS) #define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM) =20 + +/* GMP-related limits. */ + +/* Number of data bits in a limb. */ +#ifndef GMP_NUMB_BITS +enum { GMP_NUMB_BITS =3D TYPE_WIDTH (mp_limb_t) }; +#endif + #if USE_LSB_TAG =20 INLINE Lisp_Object @@ -3338,7 +3346,7 @@ extern void set_internal (Lisp_Object, Lisp_Object,= Lisp_Object, enum Set_Internal_Bind); extern void set_default_internal (Lisp_Object, Lisp_Object, enum Set_Internal_Bind bindflag); - +extern Lisp_Object expt_integer (Lisp_Object, Lisp_Object); extern void syms_of_data (void); extern void swap_in_global_binding (struct Lisp_Symbol *); =20 @@ -3700,6 +3708,7 @@ extern void display_malloc_warning (void); extern ptrdiff_t inhibit_garbage_collection (void); extern Lisp_Object build_overlay (Lisp_Object, Lisp_Object, Lisp_Object)= ; extern void free_cons (struct Lisp_Cons *); +extern _Noreturn void integer_overflow (void); extern void init_alloc_once (void); extern void init_alloc (void); extern void syms_of_alloc (void); --=20 2.17.1 --------------F280AC23312D69F6EF729036-- From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Aug 2018 10:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153484864227696 (code B ref -1); Tue, 21 Aug 2018 10:51:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 Aug 2018 10:50:42 +0000 Received: from localhost ([127.0.0.1]:56237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fs4FG-0007Ce-Ia for submit@debbugs.gnu.org; Tue, 21 Aug 2018 06:50:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fs4FF-0007CQ-68 for submit@debbugs.gnu.org; Tue, 21 Aug 2018 06:50:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs4F8-0003ob-Pt for submit@debbugs.gnu.org; Tue, 21 Aug 2018 06:50:35 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58914) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs4F8-0003oU-MW for submit@debbugs.gnu.org; Tue, 21 Aug 2018 06:50:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs4F7-0003x7-Ti for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 06:50:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs4F3-0003mH-43 for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 06:50:33 -0400 Received: from [195.159.176.226] (port=52669 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fs4F2-0003kb-Py for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 06:50:28 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fs4Cq-0000P7-MZ for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 12:48:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Tue, 21 Aug 2018 11:50:15 +0100 Lines: 20 Message-ID: References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <7b6c9c32-c301-09db-d23e-ce976afcb5c1@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:gogAIkhjF+3AB7L+q5F7nWPkIpg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.8 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.8 (-----) On Tue 21 Aug 2018, Paul Eggert wrote: > Pip Cet wrote: >> I'm not sure what a reasonable limit would be, but I think a global >> limit of bignum size to something that allows for "immediate" >> computations would be best. > > I installed the attached patch to do that. It tentatively defaults to a limit > of 2↑↑5 (i.e., 2**65536) for bignums, overrideable by setting a new variable > 'integer-width' that defaults to 65536. This default should be big enough for > almost all Emacs applications and should avoid issues of aborts and hangs. Have you checked a mini-gmp build to ensure that this patch works if the GMP library is not installed ? It might be slightly faster to use mpz_limbs_read in make_number instead of mpz_getlimbn. AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Aug 2018 14:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: andrewjmoreton@gmail.com, pipcet@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153486222525211 (code B ref 32463); Tue, 21 Aug 2018 14:38:02 +0000 Received: (at 32463) by debbugs.gnu.org; 21 Aug 2018 14:37:05 +0000 Received: from localhost ([127.0.0.1]:56871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fs7mL-0006YZ-Go for submit@debbugs.gnu.org; Tue, 21 Aug 2018 10:37:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34978) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fs7mK-0006Y5-08 for 32463@debbugs.gnu.org; Tue, 21 Aug 2018 10:37:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs7m9-00017t-VA for 32463@debbugs.gnu.org; Tue, 21 Aug 2018 10:36:58 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs7m8-000171-Ec; Tue, 21 Aug 2018 10:36:53 -0400 Received: from [176.228.60.248] (port=4587 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fs7m8-0005xc-1q; Tue, 21 Aug 2018 10:36:52 -0400 Date: Tue, 21 Aug 2018 17:36:50 +0300 Message-Id: <83r2irdbwd.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <7b6c9c32-c301-09db-d23e-ce976afcb5c1@cs.ucla.edu> (message from Paul Eggert on Tue, 21 Aug 2018 02:40:34 -0700) References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <7b6c9c32-c301-09db-d23e-ce976afcb5c1@cs.ucla.edu> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Paul Eggert > Date: Tue, 21 Aug 2018 02:40:34 -0700 > Cc: andrewjmoreton@gmail.com, 32463@debbugs.gnu.org > > I installed the attached patch to do that. It tentatively defaults to a limit of > 2↑↑5 (i.e., 2**65536) for bignums, overrideable by setting a new variable > 'integer-width' that defaults to 65536. This default should be big enough for > almost all Emacs applications and should avoid issues of aborts and hangs. Should the default value be different on 32-bit platforms? From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Aug 2018 14:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153486317926682 (code B ref -1); Tue, 21 Aug 2018 14:53:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Aug 2018 14:52:59 +0000 Received: from localhost ([127.0.0.1]:56875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fs81i-0006wI-TY for submit@debbugs.gnu.org; Tue, 21 Aug 2018 10:52:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40957) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fs81g-0006w2-Bo for submit@debbugs.gnu.org; Tue, 21 Aug 2018 10:52:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs81W-0004Vb-KD for submit@debbugs.gnu.org; Tue, 21 Aug 2018 10:52:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36523) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs81U-0004TF-Jm for submit@debbugs.gnu.org; Tue, 21 Aug 2018 10:52:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs81R-0006hB-MU for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 10:52:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs81M-0004QT-01 for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 10:52:40 -0400 Received: from [195.159.176.226] (port=33914 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fs81L-0004Pz-9C for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 10:52:35 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fs7z8-0002lV-Hg for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 16:50:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Tue, 21 Aug 2018 15:52:23 +0100 Lines: 22 Message-ID: References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <7b6c9c32-c301-09db-d23e-ce976afcb5c1@cs.ucla.edu> <83r2irdbwd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) Cancel-Lock: sha1:uirjaOlmrzqVmQspuqZFEnzEb/w= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.8 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.8 (-----) On Tue 21 Aug 2018, Eli Zaretskii wrote: >> From: Paul Eggert >> Date: Tue, 21 Aug 2018 02:40:34 -0700 >> Cc: andrewjmoreton@gmail.com, 32463@debbugs.gnu.org >> >> I installed the attached patch to do that. It tentatively defaults to a limit of >> 2↑↑5 (i.e., 2**65536) for bignums, overrideable by setting a new variable >> 'integer-width' that defaults to 65536. This default should be big enough for >> almost all Emacs applications and should avoid issues of aborts and hangs. > > Should the default value be different on 32-bit platforms? For a 32bit platform using 32bit mp_limb_t, this is only 2048 limbs, so well within range of mpz_t::_mp_size. Having the same limit on all platforms should be fine. Does this limit apply to bignum values in lisp objects, or to intermediate values inside libgmp, which may require extra space ? The documentation for `integer-width' should make this clear. AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Aug 2018 17:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: andrewjmoreton@gmail.com, pipcet@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153487225723854 (code B ref 32463); Tue, 21 Aug 2018 17:25:01 +0000 Received: (at 32463) by debbugs.gnu.org; 21 Aug 2018 17:24:17 +0000 Received: from localhost ([127.0.0.1]:56996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsAO9-0006Cf-6j for submit@debbugs.gnu.org; Tue, 21 Aug 2018 13:24:17 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:40168) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsAO7-0006CT-Lg for 32463@debbugs.gnu.org; Tue, 21 Aug 2018 13:24:16 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7892916077A; Tue, 21 Aug 2018 10:24:09 -0700 (PDT) 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 0c8UTtl8x7Z8; Tue, 21 Aug 2018 10:24:08 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C29B716099B; Tue, 21 Aug 2018 10:24:08 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 WxwHV8Xvmt1A; Tue, 21 Aug 2018 10:24:08 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 6620F16077A; Tue, 21 Aug 2018 10:24:08 -0700 (PDT) References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <7b6c9c32-c301-09db-d23e-ce976afcb5c1@cs.ucla.edu> <83r2irdbwd.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Tue, 21 Aug 2018 10:24:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <83r2irdbwd.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii wrote: > Should the default value [of integer-width] be different on 32-bit platforms? My guess is not. The current default of 2**16 means that individual bignums are limited to around 8 KiB, and even 32-bit platforms can handle that. Of course as we gain experience we may want to change the default. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 02:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andy Moreton Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153490498232696 (code B ref 32463); Wed, 22 Aug 2018 02:30:02 +0000 Received: (at 32463) by debbugs.gnu.org; 22 Aug 2018 02:29:42 +0000 Received: from localhost ([127.0.0.1]:57172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsIty-0008VH-0Z for submit@debbugs.gnu.org; Tue, 21 Aug 2018 22:29:42 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:54488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsItv-0008V3-RZ for 32463@debbugs.gnu.org; Tue, 21 Aug 2018 22:29:40 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B006D1605B1; Tue, 21 Aug 2018 19:29:33 -0700 (PDT) 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 0j_-eqt5jvsY; Tue, 21 Aug 2018 19:29:32 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 425FD1605BB; Tue, 21 Aug 2018 19:29:32 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 xsc37Z0a-r0o; Tue, 21 Aug 2018 19:29:32 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id DF3261605B1; Tue, 21 Aug 2018 19:29:31 -0700 (PDT) From: Paul Eggert References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <66c3b06d-bf67-8f61-4b13-1debf0668010@cs.ucla.edu> Organization: UCLA Computer Science Department Message-ID: <34ab2db1-29b5-1121-d269-4407190e255d@cs.ucla.edu> Date: Tue, 21 Aug 2018 19:29:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <66c3b06d-bf67-8f61-4b13-1debf0668010@cs.ucla.edu> Content-Type: multipart/mixed; boundary="------------4D81C32FEB9BC44082E4C9FD" Content-Language: en-US X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------4D81C32FEB9BC44082E4C9FD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable >>> d) Extend Fceiling, Ffloor, Fround and Ftruncate to support bignums b= y >>> =C2=A0=C2=A0 updating rounding_driver. >=20 > I worked on these and installed patches to master that should do (a), (= b), and=20 > (c). For (d) I wrote the attached patch, and plan to test it a bit more= before=20 > installing, as it's the hairiest. It took me longer to write the test cases than the code, but the tests di= d find=20 bugs so it was worth it. I installed the attached. While we're on the subject I moved the definition of 'bignump' and 'fixnu= mp'=20 from C to Lisp, since they are easily implementable in Lisp and don't see= m to be=20 performance relevant. Hope you don't mind too much that I would rather mi= nimize=20 the low-level details that the C code exports. Both patches attached. --------------4D81C32FEB9BC44082E4C9FD Content-Type: text/x-patch; name="0001-Move-bignump-fixnump-from-C-to-Lisp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Move-bignump-fixnump-from-C-to-Lisp.patch" >From c79444c5b7b8ead1ea98ed5603bf2a49c13dbf16 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 21 Aug 2018 16:06:58 -0700 Subject: [PATCH 1/2] Move bignump, fixnump from C to Lisp * doc/lispref/objects.texi (Integer Type): Mention most-negative-fixnum and most-positive-fixnum as alternatives to fixnump and bignump. * lisp/subr.el (fixnump, bignump): Now written in Lisp. * src/data.c (Ffixnump, Fbignump): No longer written in C, as these new functions are not crucial for performance. --- doc/lispref/objects.texi | 7 ++++--- lisp/subr.el | 9 +++++++++ src/data.c | 21 --------------------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 8c92de123c..a0940032ee 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -190,9 +190,10 @@ Integer Type fixnum will return a bignum instead. Fixnums can be compared with @code{eq}, but bignums require -@code{eql} or @code{=}. The @code{fixnump} predicate can be used to -detect such small integers, and @code{bignump} can be used to detect -large integers. +@code{eql} or @code{=}. To test whether an integer is a fixnum or a +bignum, you can compare it to @code{most-negative-fixnum} and +@code{most-positive-fixnum}, or you can use the convenience predicates +@code{fixnump} and @code{bignump} on any object. The read syntax for integers is a sequence of (base ten) digits with an optional sign at the beginning and an optional period at the end. The diff --git a/lisp/subr.el b/lisp/subr.el index cafa4835ea..9e880bc880 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -366,6 +366,15 @@ zerop (declare (compiler-macro (lambda (_) `(= 0 ,number)))) (= 0 number)) +(defun fixnump (object) + "Return t if OBJECT is a fixnum." + (and (integerp object) + (<= most-negative-fixnum object most-positive-fixnum))) + +(defun bignump (object) + "Return t if OBJECT is a bignum." + (and (integerp object) (not (fixnump object)))) + (defun lsh (value count) "Return VALUE with its bits shifted left by COUNT. If COUNT is negative, shifting is actually to the right. diff --git a/src/data.c b/src/data.c index 4c6d33f294..08c7271dd7 100644 --- a/src/data.c +++ b/src/data.c @@ -511,16 +511,6 @@ DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0, return Qnil; } -DEFUN ("fixnump", Ffixnump, Sfixnump, 1, 1, 0, - doc: /* Return t if OBJECT is an fixnum. */ - attributes: const) - (Lisp_Object object) -{ - if (FIXNUMP (object)) - return Qt; - return Qnil; -} - DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, 1, 1, 0, doc: /* Return t if OBJECT is an integer or a marker (editor pointer). */) (register Lisp_Object object) @@ -598,15 +588,6 @@ DEFUN ("condition-variable-p", Fcondition_variable_p, Scondition_variable_p, return Qt; return Qnil; } - -DEFUN ("bignump", Fbignump, Sbignump, 1, 1, 0, - doc: /* Return t if OBJECT is a bignum. */) - (Lisp_Object object) -{ - if (BIGNUMP (object)) - return Qt; - return Qnil; -} /* Extract and set components of lists. */ @@ -4153,7 +4134,6 @@ syms_of_data (void) defsubr (&Sconsp); defsubr (&Satom); defsubr (&Sintegerp); - defsubr (&Sfixnump); defsubr (&Sinteger_or_marker_p); defsubr (&Snumberp); defsubr (&Snumber_or_marker_p); @@ -4179,7 +4159,6 @@ syms_of_data (void) defsubr (&Sthreadp); defsubr (&Smutexp); defsubr (&Scondition_variable_p); - defsubr (&Sbignump); defsubr (&Scar); defsubr (&Scdr); defsubr (&Scar_safe); -- 2.17.1 --------------4D81C32FEB9BC44082E4C9FD Content-Type: text/x-patch; name="0002-Add-bignum-support-to-floor-ceiling-etc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-Add-bignum-support-to-floor-ceiling-etc.patch" >From 30efb8ed6c0968ca486081112f8d4dc147af9e6c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 21 Aug 2018 19:23:45 -0700 Subject: [PATCH 2/2] Add bignum support to floor, ceiling, etc. Problem reported by Andy Moreton (Bug#32463#35 (d)). * src/floatfns.c (rounding_driver): Change the signature of the integer rounder to use mpz_t rather than EMACS_INT. All uses changed. Support bignums. (ceiling2, floor2, truncate2, round2): Remove. All uses changed to rounddiv_q or to a GMP library function. (rounddiv_q): New function. * test/src/floatfns-tests.el (bignum-round): New test. --- src/floatfns.c | 95 ++++++++++++++++++++++---------------- test/src/floatfns-tests.el | 27 +++++++++++ 2 files changed, 82 insertions(+), 40 deletions(-) diff --git a/src/floatfns.c b/src/floatfns.c index ea9000b90a..c09fe9d6a5 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -357,10 +357,10 @@ This is the same as the exponent of a float. */) static Lisp_Object rounding_driver (Lisp_Object arg, Lisp_Object divisor, double (*double_round) (double), - EMACS_INT (*int_round2) (EMACS_INT, EMACS_INT), + void (*int_divide) (mpz_t, mpz_t const, mpz_t const), const char *name) { - CHECK_FIXNUM_OR_FLOAT (arg); + CHECK_NUMBER (arg); double d; if (NILP (divisor)) @@ -371,12 +371,25 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor, } else { - CHECK_FIXNUM_OR_FLOAT (divisor); + CHECK_NUMBER (divisor); if (!FLOATP (arg) && !FLOATP (divisor)) { - if (XFIXNUM (divisor) == 0) + if (EQ (divisor, make_fixnum (0))) xsignal0 (Qarith_error); - return make_fixnum (int_round2 (XFIXNUM (arg), XFIXNUM (divisor))); + mpz_t d, q; + mpz_init (d); + mpz_init (q); + int_divide (q, + (FIXNUMP (arg) + ? (mpz_set_intmax (q, XFIXNUM (arg)), q) + : XBIGNUM (arg)->value), + (FIXNUMP (divisor) + ? (mpz_set_intmax (d, XFIXNUM (divisor)), d) + : XBIGNUM (divisor)->value)); + Lisp_Object result = make_number (q); + mpz_clear (d); + mpz_clear (q); + return result; } double f1 = FLOATP (arg) ? XFLOAT_DATA (arg) : XFIXNUM (arg); @@ -400,37 +413,39 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor, xsignal2 (Qrange_error, build_string (name), arg); } -static EMACS_INT -ceiling2 (EMACS_INT i1, EMACS_INT i2) -{ - return i1 / i2 + ((i1 % i2 != 0) & ((i1 < 0) == (i2 < 0))); -} - -static EMACS_INT -floor2 (EMACS_INT i1, EMACS_INT i2) -{ - return i1 / i2 - ((i1 % i2 != 0) & ((i1 < 0) != (i2 < 0))); -} - -static EMACS_INT -truncate2 (EMACS_INT i1, EMACS_INT i2) -{ - return i1 / i2; -} - -static EMACS_INT -round2 (EMACS_INT i1, EMACS_INT i2) -{ - /* The C language's division operator gives us one remainder R, but - we want the remainder R1 on the other side of 0 if R1 is closer - to 0 than R is; because we want to round to even, we also want R1 - if R and R1 are the same distance from 0 and if C's quotient is - odd. */ - EMACS_INT q = i1 / i2; - EMACS_INT r = i1 % i2; - EMACS_INT abs_r = eabs (r); - EMACS_INT abs_r1 = eabs (i2) - abs_r; - return q + (abs_r + (q & 1) <= abs_r1 ? 0 : (i2 ^ r) < 0 ? -1 : 1); +static void +rounddiv_q (mpz_t q, mpz_t const n, mpz_t const d) +{ + /* mpz_tdiv_qr gives us one remainder R, but we want the remainder + R1 on the other side of 0 if R1 is closer to 0 than R is; because + we want to round to even, we also want R1 if R and R1 are the + same distance from 0 and if the quotient is odd. + + If we were using EMACS_INT arithmetic instead of bignums, + the following code could look something like this: + + q = n / d; + r = n % d; + neg_d = d < 0; + neg_r = r < 0; + r = eabs (r); + abs_r1 = eabs (d) - r; + if (abs_r1 < r + (q & 1)) + q += neg_d == neg_r ? 1 : -1; */ + + mpz_t r, abs_r1; + mpz_init (r); + mpz_init (abs_r1); + mpz_tdiv_qr (q, r, n, d); + bool neg_d = mpz_sgn (d) < 0; + bool neg_r = mpz_sgn (r) < 0; + mpz_abs (r, r); + mpz_abs (abs_r1, d); + mpz_sub (abs_r1, abs_r1, r); + if (mpz_cmp (abs_r1, r) < (mpz_odd_p (q) != 0)) + (neg_d == neg_r ? mpz_add_ui : mpz_sub_ui) (q, q, 1); + mpz_clear (r); + mpz_clear (abs_r1); } /* The code uses emacs_rint, so that it works to undefine HAVE_RINT @@ -461,7 +476,7 @@ This rounds the value towards +inf. With optional DIVISOR, return the smallest integer no less than ARG/DIVISOR. */) (Lisp_Object arg, Lisp_Object divisor) { - return rounding_driver (arg, divisor, ceil, ceiling2, "ceiling"); + return rounding_driver (arg, divisor, ceil, mpz_cdiv_q, "ceiling"); } DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0, @@ -470,7 +485,7 @@ This rounds the value towards -inf. With optional DIVISOR, return the largest integer no greater than ARG/DIVISOR. */) (Lisp_Object arg, Lisp_Object divisor) { - return rounding_driver (arg, divisor, floor, floor2, "floor"); + return rounding_driver (arg, divisor, floor, mpz_fdiv_q, "floor"); } DEFUN ("round", Fround, Sround, 1, 2, 0, @@ -483,7 +498,7 @@ your machine. For example, (round 2.5) can return 3 on some systems, but 2 on others. */) (Lisp_Object arg, Lisp_Object divisor) { - return rounding_driver (arg, divisor, emacs_rint, round2, "round"); + return rounding_driver (arg, divisor, emacs_rint, rounddiv_q, "round"); } DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0, @@ -492,7 +507,7 @@ Rounds ARG toward zero. With optional DIVISOR, truncate ARG/DIVISOR. */) (Lisp_Object arg, Lisp_Object divisor) { - return rounding_driver (arg, divisor, trunc, truncate2, "truncate"); + return rounding_driver (arg, divisor, trunc, mpz_tdiv_q, "truncate"); } diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el index e4caaa1e49..592efce359 100644 --- a/test/src/floatfns-tests.el +++ b/test/src/floatfns-tests.el @@ -58,4 +58,31 @@ (ert-deftest bignum-mod () (should (= 0 (mod (1+ most-positive-fixnum) 2.0)))) +(ert-deftest bignum-round () + (let ((ns (list (* most-positive-fixnum most-negative-fixnum) + (1- most-negative-fixnum) most-negative-fixnum + (1+ most-negative-fixnum) -2 1 1 2 + (1- most-positive-fixnum) most-positive-fixnum + (1+ most-positive-fixnum) + (* most-positive-fixnum most-positive-fixnum)))) + (dolist (n ns) + (dolist (d ns) + (let ((q (/ n d)) + (r (% n d)) + (same-sign (eq (< n 0) (< d 0)))) + (should (= (ceiling n d) + (+ q (if (and same-sign (not (zerop r))) 1 0)))) + (should (= (floor n d) + (- q (if (and (not same-sign) (not (zerop r))) 1 0)))) + (should (= (truncate n d) q)) + (let ((cdelta (abs (- n (* d (ceiling n d))))) + (fdelta (abs (- n (* d (floor n d))))) + (rdelta (abs (- n (* d (round n d)))))) + (should (<= rdelta cdelta)) + (should (<= rdelta fdelta)) + (should (if (zerop r) + (= 0 cdelta fdelta rdelta) + (or (/= cdelta fdelta) + (zerop (% (round n d) 2))))))))))) + (provide 'floatfns-tests) -- 2.17.1 --------------4D81C32FEB9BC44082E4C9FD-- From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 References: In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 02:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andy Moreton Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.1534905286778 (code B ref 32463); Wed, 22 Aug 2018 02:35:02 +0000 Received: (at 32463) by debbugs.gnu.org; 22 Aug 2018 02:34:46 +0000 Received: from localhost ([127.0.0.1]:57177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsIyr-0000CU-VJ for submit@debbugs.gnu.org; Tue, 21 Aug 2018 22:34:46 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:54884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsIyp-0000CD-7k for 32463@debbugs.gnu.org; Tue, 21 Aug 2018 22:34:45 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A29641605B1; Tue, 21 Aug 2018 19:34:37 -0700 (PDT) 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 FBG6HKCuXDzq; Tue, 21 Aug 2018 19:34:37 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EA4E71605BB; Tue, 21 Aug 2018 19:34:36 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 cd_33msMgS_n; Tue, 21 Aug 2018 19:34:36 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A70651605B1; Tue, 21 Aug 2018 19:34:36 -0700 (PDT) From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <0a84a85a-a5df-e557-72ee-6a28b478a92c@cs.ucla.edu> Date: Tue, 21 Aug 2018 19:34:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Does this limit apply to bignum values in lisp objects, or to > intermediate values inside libgmp, which may require extra space ? > The documentation for `integer-width' should make this clear. integer-width applies only to Lisp objects. I'm not sure we should be exposing internal details of the interpreter to the Lisp user, which includes the sizes of its internal temporaries. If a need shows up for it we can do it, but I don't see the need. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 References: In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 02:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andy Moreton Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15349065982774 (code B ref 32463); Wed, 22 Aug 2018 02:57:02 +0000 Received: (at 32463) by debbugs.gnu.org; 22 Aug 2018 02:56:38 +0000 Received: from localhost ([127.0.0.1]:57181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsJK1-0000ig-PA for submit@debbugs.gnu.org; Tue, 21 Aug 2018 22:56:38 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsJK0-0000iS-GS for 32463@debbugs.gnu.org; Tue, 21 Aug 2018 22:56:36 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C5A831605B1; Tue, 21 Aug 2018 19:56:30 -0700 (PDT) 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 G5819DWGS_I0; Tue, 21 Aug 2018 19:56:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1FE321605BB; Tue, 21 Aug 2018 19:56:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 XRpXFe4J0KxH; Tue, 21 Aug 2018 19:56:30 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D18AF1605B1; Tue, 21 Aug 2018 19:56:29 -0700 (PDT) From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <4c125a8e-ebb8-b37f-8021-689b506b55f2@cs.ucla.edu> Date: Tue, 21 Aug 2018 19:56:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Have you checked a mini-gmp build to ensure that this patch works if > the GMP library is not installed ? I have now. :-) It works, in the sense that Emacs builds and fails only the tests that it was already failing. > It might be slightly faster to use mpz_limbs_read in make_number instead > of mpz_getlimbn. On Fedora 28 x86-64, mpz_getlimbn is inline whereas mpz_limbs_read is a function call, so it's not clear which should be faster. Another item on the list of things to do.... From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 08:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15349260832009 (code B ref -1); Wed, 22 Aug 2018 08:22:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Aug 2018 08:21:23 +0000 Received: from localhost ([127.0.0.1]:57226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsOOJ-0000WL-0b for submit@debbugs.gnu.org; Wed, 22 Aug 2018 04:21:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47337) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsOOG-0000W6-Nb for submit@debbugs.gnu.org; Wed, 22 Aug 2018 04:21:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsOO9-0007JS-QH for submit@debbugs.gnu.org; Wed, 22 Aug 2018 04:21:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58696) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsOO8-0007Ip-F2 for submit@debbugs.gnu.org; Wed, 22 Aug 2018 04:21:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsOO7-0001Vo-IP for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 04:21:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsOO1-0007FD-Ub for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 04:21:09 -0400 Received: from [195.159.176.226] (port=47455 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fsOO1-0007CS-Ea for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 04:21:05 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fsOLr-0003ur-2D for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 10:18:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Wed, 22 Aug 2018 09:20:54 +0100 Lines: 16 Message-ID: <86in42vml5.fsf@gmail.com> References: <4c125a8e-ebb8-b37f-8021-689b506b55f2@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:xGOFAX6bshZpwvkzMoslD2p0BWI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.8 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.8 (-----) On Tue 21 Aug 2018, Paul Eggert wrote: >> Have you checked a mini-gmp build to ensure that this patch works if >> the GMP library is not installed ? > > I have now. :-) It works, in the sense that Emacs builds and fails only the > tests that it was already failing. Thanks. I mentioned this because GMP_NUMB_BITS etc are not defined in mini-gmp.h (which your patches handle), but I wasn't sure if there were other symbols that needed similar treatment. As GMP_NUMB_BITS is always defined now, uses of mp_bits_per_limb could be replaced with GMP_NUMB_BITS. AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 08:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15349272253811 (code B ref -1); Wed, 22 Aug 2018 08:41:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Aug 2018 08:40:25 +0000 Received: from localhost ([127.0.0.1]:57232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsOgj-0000zO-Jy for submit@debbugs.gnu.org; Wed, 22 Aug 2018 04:40:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53357) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsOgi-0000z7-EM for submit@debbugs.gnu.org; Wed, 22 Aug 2018 04:40:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsOgZ-0002G3-R1 for submit@debbugs.gnu.org; Wed, 22 Aug 2018 04:40:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58390) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsOgV-0002DV-IW for submit@debbugs.gnu.org; Wed, 22 Aug 2018 04:40:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsOgU-0003CC-Hq for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 04:40:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsOgN-000297-4T for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 04:40:06 -0400 Received: from [195.159.176.226] (port=48538 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fsOgM-00027m-TK for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 04:40:03 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fsOeD-0002p3-DF for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 10:37:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Wed, 22 Aug 2018 09:39:50 +0100 Lines: 26 Message-ID: <86efeqvlpl.fsf@gmail.com> References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <66c3b06d-bf67-8f61-4b13-1debf0668010@cs.ucla.edu> <34ab2db1-29b5-1121-d269-4407190e255d@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:3vVmvKis6itI0YNVS7tNm2by9NI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.8 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.8 (-----) On Tue 21 Aug 2018, Paul Eggert wrote: >>>> d) Extend Fceiling, Ffloor, Fround and Ftruncate to support bignums by >>>>    updating rounding_driver. >> >> I worked on these and installed patches to master that should do (a), (b), >> and (c). For (d) I wrote the attached patch, and plan to test it a bit more >> before installing, as it's the hairiest. > > It took me longer to write the test cases than the code, but the tests did > find bugs so it was worth it. I installed the attached. Thanks for all of your recent work on bignum issues, which has siginificantly improved the bignum implementation. > While we're on the subject I moved the definition of 'bignump' and 'fixnump' > from C to Lisp, since they are easily implementable in Lisp and don't seem to > be performance relevant. Hope you don't mind too much that I would rather > minimize the low-level details that the C code exports. I agree that performance is not an issue. However implementing these in lisp assumes that bignums never represent values in fixnum range, rather than checking that. We need some checks at the C level to ensure that this property always holds. AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Tom Tromey Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 16:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: Andy Moreton , 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153495702027070 (code B ref 32463); Wed, 22 Aug 2018 16:57:02 +0000 Received: (at 32463) by debbugs.gnu.org; 22 Aug 2018 16:57:00 +0000 Received: from localhost ([127.0.0.1]:57940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsWRI-00072Y-Ax for submit@debbugs.gnu.org; Wed, 22 Aug 2018 12:57:00 -0400 Received: from gateway36.websitewelcome.com ([192.185.192.36]:12438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsWRG-00072O-HD for 32463@debbugs.gnu.org; Wed, 22 Aug 2018 12:56:59 -0400 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 738BA400F1FC1 for <32463@debbugs.gnu.org>; Wed, 22 Aug 2018 11:00:41 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id sWRFf4o1cSjJAsWRFfl2Ta; Wed, 22 Aug 2018 11:56:57 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=WEbynOsTbVw4FzFgeTrS5iRcBwQ1471rkPcxd4Btj3Q=; b=S5hSC7t1PdIWX1haDZNkRKL52A iUU41OfYwM4bOGTT8SveFLTRpWKDPQY2E87COkf5Usd82ResV1FdJ201Ky1aFtV8Ytge6cMSdDLO4 LoenUqJSd/BVCXO2kQcUjfuzP; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:39684 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fsWRF-001O2B-H1; Wed, 22 Aug 2018 11:56:57 -0500 From: Tom Tromey References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> X-Attribution: Tom Date: Wed, 22 Aug 2018 10:56:56 -0600 In-Reply-To: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> (Paul Eggert's message of "Sat, 18 Aug 2018 15:56:55 -0700") Message-ID: <87sh362vc7.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.85.72 X-Source-L: No X-Exim-ID: 1fsWRF-001O2B-H1 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-85-72.hlrn.qwest.net (bapiya) [75.166.85.72]:39684 X-Source-Auth: tom+tromey.com X-Email-Count: 9 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> "Paul" == Paul Eggert writes: Paul> My bigger concern is memory management, along with integer overflow in Paul> size or bitcount calculation. Copies are made of bignums when not Paul> needed One idea is to change make_number to take ownership of the passed-in mpz_t. I didn't do this because it makes the API confusing to use (I put in a comment to this effect) but perhaps efficiency outweighs this; and anyway the function could be renamed to make this more clear. Tom From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 17:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tom Tromey Cc: Andy Moreton , 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153496038632441 (code B ref 32463); Wed, 22 Aug 2018 17:54:01 +0000 Received: (at 32463) by debbugs.gnu.org; 22 Aug 2018 17:53:06 +0000 Received: from localhost ([127.0.0.1]:57962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsXJa-0008RB-9y for submit@debbugs.gnu.org; Wed, 22 Aug 2018 13:53:06 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56930) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsXJW-0008Qd-CD for 32463@debbugs.gnu.org; Wed, 22 Aug 2018 13:53:04 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9BB2B161624; Wed, 22 Aug 2018 10:52:54 -0700 (PDT) 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 o7l8QqIM6gpz; Wed, 22 Aug 2018 10:52:54 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E9478161631; Wed, 22 Aug 2018 10:52:53 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 xzJsXVj69IEZ; Wed, 22 Aug 2018 10:52:53 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 9BFE2161624; Wed, 22 Aug 2018 10:52:53 -0700 (PDT) References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <87sh362vc7.fsf@tromey.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <33788740-9361-4883-c5a5-279da6ae4739@cs.ucla.edu> Date: Wed, 22 Aug 2018 10:52:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <87sh362vc7.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Tom Tromey wrote: > One idea is to change make_number to take ownership of the passed-in mpz_t. > I didn't do this because it makes the API confusing to use (I put in a > comment to this effect) but perhaps efficiency outweighs this; and > anyway the function could be renamed to make this more clear. I plan to look into doing something along those lines. (Also, change its name to make_integer, since it doesn't make floats.) From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 18:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: tom@tromey.com, andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15349623472998 (code B ref 32463); Wed, 22 Aug 2018 18:26:02 +0000 Received: (at 32463) by debbugs.gnu.org; 22 Aug 2018 18:25:47 +0000 Received: from localhost ([127.0.0.1]:57972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsXpD-0000mI-Df for submit@debbugs.gnu.org; Wed, 22 Aug 2018 14:25:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsXpB-0000m4-KG for 32463@debbugs.gnu.org; Wed, 22 Aug 2018 14:25:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsXp1-0002sY-NW for 32463@debbugs.gnu.org; Wed, 22 Aug 2018 14:25:40 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsXp1-0002sU-JN; Wed, 22 Aug 2018 14:25:35 -0400 Received: from [176.228.60.248] (port=2208 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fsXp1-0003tF-6h; Wed, 22 Aug 2018 14:25:35 -0400 Date: Wed, 22 Aug 2018 21:25:28 +0300 Message-Id: <83pnyab6nb.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <33788740-9361-4883-c5a5-279da6ae4739@cs.ucla.edu> (message from Paul Eggert on Wed, 22 Aug 2018 10:52:53 -0700) References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <87sh362vc7.fsf@tromey.com> <33788740-9361-4883-c5a5-279da6ae4739@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Paul Eggert > Date: Wed, 22 Aug 2018 10:52:53 -0700 > Cc: Andy Moreton , 32463@debbugs.gnu.org > > Also, change its name to make_integer, since it doesn't make > floats. I'd rather we left the name alone. It's a veteran name, burnt into our muscle memory by many years of coding in Emacs. Let's not change it just because it isn't 100% accurate. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Aug 2018 23:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32463@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15349805111482 (code B ref -1); Wed, 22 Aug 2018 23:29:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Aug 2018 23:28:31 +0000 Received: from localhost ([127.0.0.1]:58142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fscYA-0000Nq-MO for submit@debbugs.gnu.org; Wed, 22 Aug 2018 19:28:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fscY9-0000Na-4h for submit@debbugs.gnu.org; Wed, 22 Aug 2018 19:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fscY3-0003mH-7E for submit@debbugs.gnu.org; Wed, 22 Aug 2018 19:28:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58873) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fscY3-0003mD-46 for submit@debbugs.gnu.org; Wed, 22 Aug 2018 19:28:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fscY2-0001Wo-Ak for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 19:28:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fscXw-0003h4-9Q for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 19:28:22 -0400 Received: from [195.159.176.226] (port=45772 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fscXu-0003Zy-8k for bug-gnu-emacs@gnu.org; Wed, 22 Aug 2018 19:28:15 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fscVe-0005qP-Aa for bug-gnu-emacs@gnu.org; Thu, 23 Aug 2018 01:25:54 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Andy Moreton Date: Thu, 23 Aug 2018 00:27:55 +0100 Lines: 26 Message-ID: <867ekidls4.fsf@gmail.com> References: <0a84a85a-a5df-e557-72ee-6a28b478a92c@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) Cancel-Lock: sha1:bHEyiKKS53pzbHycmox+sXMu9GA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.8 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.8 (-----) On Tue 21 Aug 2018, Paul Eggert wrote: >> Does this limit apply to bignum values in lisp objects, or to >> intermediate values inside libgmp, which may require extra space ? >> The documentation for `integer-width' should make this clear. > > integer-width applies only to Lisp objects. I'm not sure we should be exposing > internal details of the interpreter to the Lisp user, which includes the sizes > of its internal temporaries. If a need shows up for it we can do it, but I > don't see the need. The current documentation is uninformative: Maximum number of bits in bignums. Integers outside the fixnum range are limited to absolute values less than 2**N, where N is this variable’s value. N should be nonnegative. This says plenty abut fixnums, but does not mention that anything larger than fixnum range is represented as a bignum. For users who are new to all of this, it is important to state that. I think it is worth mentioning that intermediate computations not visible to lisp may use slightly larger bignums, and to make it clear that this is a soft limit intended to prevent misbehaviour of the runtime. AndyM From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Aug 2018 00:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: tom@tromey.com, andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153498414015718 (code B ref 32463); Thu, 23 Aug 2018 00:29:02 +0000 Received: (at 32463) by debbugs.gnu.org; 23 Aug 2018 00:29:00 +0000 Received: from localhost ([127.0.0.1]:58163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsdUi-00045S-Gk for submit@debbugs.gnu.org; Wed, 22 Aug 2018 20:29:00 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:54564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsdUf-00045C-Vg for 32463@debbugs.gnu.org; Wed, 22 Aug 2018 20:28:58 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D2C101606D7; Wed, 22 Aug 2018 17:28:51 -0700 (PDT) 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 Jqr1Vq9Uuzal; Wed, 22 Aug 2018 17:28:51 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 01D461607BB; Wed, 22 Aug 2018 17:28:51 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu 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 yNbHG7N9Xddv; Wed, 22 Aug 2018 17:28:50 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 63A091606D7; Wed, 22 Aug 2018 17:28:50 -0700 (PDT) References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <87sh362vc7.fsf@tromey.com> <33788740-9361-4883-c5a5-279da6ae4739@cs.ucla.edu> <83pnyab6nb.fsf@gnu.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Wed, 22 Aug 2018 17:28:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <83pnyab6nb.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii wrote: > I'd rather we left the name alone. It's a veteran name, burnt into > our muscle memory by many years of coding in Emacs. But the name 'make_number' means something completely different now; it has a different signature, it is a lot more expensive than it used to be, and it cannot be used the way the old name could be used. So now is a good time to change the name anyway, regardless of whether the name choice was a good one originally. We already changed the name XINT and friends, even though their semantics didn't change. It would be odd if we didn't fix make_number too, while we're in the neighborhood, since the case for changing it is even stronger than the case for XINT etc. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Aug 2018 02:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: tom@tromey.com, andrewjmoreton@gmail.com, 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.15349920154981 (code B ref 32463); Thu, 23 Aug 2018 02:41:01 +0000 Received: (at 32463) by debbugs.gnu.org; 23 Aug 2018 02:40:15 +0000 Received: from localhost ([127.0.0.1]:58214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsfXj-0001IH-FW for submit@debbugs.gnu.org; Wed, 22 Aug 2018 22:40:15 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44519) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsfXi-0001I1-B0 for 32463@debbugs.gnu.org; Wed, 22 Aug 2018 22:40:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsfXZ-0000SW-00 for 32463@debbugs.gnu.org; Wed, 22 Aug 2018 22:40:08 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsfXY-0000SS-SM; Wed, 22 Aug 2018 22:40:04 -0400 Received: from [176.228.60.248] (port=1478 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fsfXY-0002ee-F3; Wed, 22 Aug 2018 22:40:04 -0400 Date: Thu, 23 Aug 2018 05:39:49 +0300 Message-Id: <83lg8xbybu.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Paul Eggert on Wed, 22 Aug 2018 17:28:49 -0700) References: <5230a57b-5896-606d-f157-2e547710b6e8@cs.ucla.edu> <87sh362vc7.fsf@tromey.com> <33788740-9361-4883-c5a5-279da6ae4739@cs.ucla.edu> <83pnyab6nb.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > Cc: tom@tromey.com, andrewjmoreton@gmail.com, 32463@debbugs.gnu.org > From: Paul Eggert > Date: Wed, 22 Aug 2018 17:28:49 -0700 > > Eli Zaretskii wrote: > > I'd rather we left the name alone. It's a veteran name, burnt into > > our muscle memory by many years of coding in Emacs. > > But the name 'make_number' means something completely different now; it has a > different signature, it is a lot more expensive than it used to be, and it > cannot be used the way the old name could be used. Then perhaps restore the old make_number and make a new function with the extra functionality. > We already changed the name XINT and friends, even though their semantics didn't > change. And it's already a significant blow to coding habits. I wonder when this renaming spree will end, because it's beginning to look like a whole new language to learn. From unknown Sun Jun 22 03:56:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Aug 2018 14:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andy Moreton Cc: 32463@debbugs.gnu.org Received: via spool by 32463-submit@debbugs.gnu.org id=B32463.153503315620106 (code B ref 32463); Thu, 23 Aug 2018 14:06:01 +0000 Received: (at 32463) by debbugs.gnu.org; 23 Aug 2018 14:05:56 +0000 Received: from localhost ([127.0.0.1]:58968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsqFH-0005EE-LV for submit@debbugs.gnu.org; Thu, 23 Aug 2018 10:05:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34556) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsqFG-0005Dz-1S for 32463@debbugs.gnu.org; Thu, 23 Aug 2018 10:05:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsqF9-0005rp-2m for 32463@debbugs.gnu.org; Thu, 23 Aug 2018 10:05:48 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34320) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsqF8-0005rT-Uy; Thu, 23 Aug 2018 10:05:47 -0400 Received: from [176.228.60.248] (port=4646 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fsqF8-0007z5-4e; Thu, 23 Aug 2018 10:05:46 -0400 Date: Thu, 23 Aug 2018 17:05:31 +0300 Message-Id: <836001b2l0.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <867ekidls4.fsf@gmail.com> (message from Andy Moreton on Thu, 23 Aug 2018 00:27:55 +0100) References: <0a84a85a-a5df-e557-72ee-6a28b478a92c@cs.ucla.edu> <867ekidls4.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Andy Moreton > Date: Thu, 23 Aug 2018 00:27:55 +0100 > > The current documentation is uninformative: > > Maximum number of bits in bignums. > Integers outside the fixnum range are limited to absolute values less > than 2**N, where N is this variable’s value. N should be nonnegative. > > This says plenty abut fixnums, but does not mention that anything larger > than fixnum range is represented as a bignum. For users who are new to > all of this, it is important to state that. > > I think it is worth mentioning that intermediate computations not visible > to lisp may use slightly larger bignums, and to make it clear that this > is a soft limit intended to prevent misbehaviour of the runtime. Feel free to propose a documentation patch, and let's take it from there. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 27 16:43:49 2018 Received: (at control) by debbugs.gnu.org; 27 Aug 2018 20:43:49 +0000 Received: from localhost ([127.0.0.1]:34494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuOMX-0004bl-2p for submit@debbugs.gnu.org; Mon, 27 Aug 2018 16:43:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuOMV-0004bT-Fi for control@debbugs.gnu.org; Mon, 27 Aug 2018 16:43:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fuOMO-00007c-3q for control@debbugs.gnu.org; Mon, 27 Aug 2018 16:43:42 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fuOMM-000060-3X for control@debbugs.gnu.org; Mon, 27 Aug 2018 16:43:38 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1fuOML-0003ss-Bw for control@debbugs.gnu.org; Mon, 27 Aug 2018 16:43:38 -0400 Subject: control message for bug 32463 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Mon, 27 Aug 2018 16:43:37 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) # 64eb9b7 close 32463