From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.bugs Subject: bug#32463: 27.0.50; (logior -1) => 4611686018427387903 Date: Fri, 17 Aug 2018 14:24:02 +0100 Message-ID: References: <86mutll4w2.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1534512191 12236 195.159.176.226 (17 Aug 2018 13:23:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2018 13:23:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt) To: 32463@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 17 15:23:06 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fqeiY-00035J-MX for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Aug 2018 15:23:06 +0200 Original-Received: from localhost ([::1]:33857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqekf-0008KH-8p for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Aug 2018 09:25:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqekV-0008JM-Gg for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:25:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqekQ-0006fY-5W for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:25:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48325) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fqekQ-0006fF-07 for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fqekP-0000nO-N5 for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2018 09:25:01 -0400 X-Loop: help-debbugs@gnu.org 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: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15345122662995 (code B ref -1); Fri, 17 Aug 2018 13:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Aug 2018 13:24:26 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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/ Original-Lines: 52 Original-X-Complaints-To: usenet@blaine.gmane.org 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149556 Archived-At: 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