From unknown Mon Aug 18 17:54:50 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14864: bitwise-arithmetic-shift-right is wrong for large shift amounts Resent-From: =?UTF-8?Q?G=C3=B6ran?= Weinholt Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 14 Jul 2013 16:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14864 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 14864@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.137381845927606 (code B ref -1); Sun, 14 Jul 2013 16:15:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jul 2013 16:14:19 +0000 Received: from localhost ([127.0.0.1]:54094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyOwE-0007BB-V9 for submit@debbugs.gnu.org; Sun, 14 Jul 2013 12:14:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55123) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyOwC-0007Af-K7 for submit@debbugs.gnu.org; Sun, 14 Jul 2013 12:14:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyOw6-0006TB-Cy for submit@debbugs.gnu.org; Sun, 14 Jul 2013 12:14:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-99.2 required=5.0 tests=BAYES_50,T_DKIM_INVALID, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyOw6-0006T7-AR for submit@debbugs.gnu.org; Sun, 14 Jul 2013 12:14:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyOw5-0006ee-Cx for bug-guile@gnu.org; Sun, 14 Jul 2013 12:14:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyOw4-0006Su-Ck for bug-guile@gnu.org; Sun, 14 Jul 2013 12:14:09 -0400 Received: from iustitia.weinholt.se ([2a02:28f0:0:a::7dce:e5a8]:36496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyOw4-0006Sl-0m for bug-guile@gnu.org; Sun, 14 Jul 2013 12:14:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=weinholt.se; s=iustitia2012; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=kzPX8ifyIvmJS93g/Gi7F4CRB+1iRBScqiuldej9MEM=; b=laXnN+D3C7TllouSdZTcoft67F4NSySjJnYIgkB8a4lNj/zyaIik7PGKNLGxA6sDPsP649WQHUFdT3wOYe/bUDiyAYQmSUgAPPTugabDDfqYSZskeevddX4DnpvKlDhOBZbt12/rNUczVZmiHBXLo1RuiNZLcvyr/i8E3AgjES9vhhA9PqoC4Iu2eVOlndmOIFfC2zTIvW3MjLCsrKxMqBHAtLJWKK94CQpveGOArrVt+KJwDpGuiBCxInBu7drW3UKGDb3GjM/RAocnTRoyliz2GiqXsknxHvK3JtwxoSTdWcx7yXs96ap2SelFDalYVx8WnNfqsq3OE0WuAfr3tA==; Received: from uucp by iustitia.weinholt.se with local-bsmtp (Exim 4.72) (envelope-from ) id 1UyOw2-0006Pe-Li; Sun, 14 Jul 2013 18:14:06 +0200 Received: from weinholt by industria with local (Exim 4.80) (envelope-from ) id 1UyOr2-00056P-7p; Sun, 14 Jul 2013 18:08:56 +0200 X-Hashcash: 1:20:130714:bug-guile@gnu.org::PGDspBnhoqf+sq8s:000000000000000000000000000000000000000000004wSM From: =?UTF-8?Q?G=C3=B6ran?= Weinholt Date: Sun, 14 Jul 2013 18:08:55 +0200 Message-ID: <87a9lpdsyw.fsf@industria.weinholt.se> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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.15 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.0 (-----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello schemers, bitwise-arithmetic-shift-right from (rnrs) is wrong for ridiculously large shift amounts: scheme@(guile-user)> (import (rnrs)) scheme@(guile-user)> (bitwise-arithmetic-shift-right -2 (+ (greatest-fixnum= ) 1)) $1 =3D -2 The correct result is -1. Tested on an amd64 system with guile-2.0.9.20-10454-dirty. Here are a few more failing cases, if it helps: (bitwise-arithmetic-shift-right -1939573486025768832 1842615318141600354) =3D> =2D112898036 ; *** failed *** ; expected result: -1 (bitwise-arithmetic-shift-right 1344211617424411880 1877595747324902264) =3D> 18 ; *** failed *** ; expected result: 0 (bitwise-arithmetic-shift-right -1152921504606846979 88553614889043251) =3D> =2D513 ; *** failed *** ; expected result: -1 (bitwise-arithmetic-shift-right -870600743868926059 1508151148) =3D> =2D49488 ; *** failed *** ; expected result: -1 Regards, =2D-=20 G=C3=B6ran Weinholt 13 MR. JAKES: I think our economy was based on 14 industrial process. 15 JUSTICE SCALIA: It was based on horses, for 16 Pete's sake. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCgAGBQJR4s0XAAoJEOM+YaLpuMOi9OwP/ApHe0ZvvWYaUWh9Ay3TFoo9 iGMgI8NCcbhqeSUYsDwGdf9PAPr8zzmJEHud7a7ghHgtmGcAOKxYNF2LkzplE+pG ICybtZxkyHvo6Ta71QguUrGR9Ezk7idsdmWvhjMmN0Xz1C9Y5+qdflNcP1uoP8Jq ywfX8VnvLIzjiWgpvfyi+rZnYSDiKgFZOF/RiFSJMppxy5M61rTtSe1gSfZjRq4v FNWZ/zZacXbCWV6/DbTgAgm5olDGlnA4hRBXQJm4l9QTykJxGFmrmRYsNyOmS8ZV kl+WJPP9YE4LehHFtianbinU7eZaRv6ZZMmyqGi41F543i5K9z2vhHAk035b8wj2 BPNehxcMh+EHTMV3sSxh1dVK9Rsyy6YE5em14YeDvUP2BoRlRLFc/e30BuZgUOCM tQ+FQy7m9QjAOqRGf/flmxVxEEqsryx30IKMmlWSHEho+NmPKxRKglhaxNwGA4NB pjqy86r5QZ84wCZ6+SHg+RF036N274xG+q7OX6aQu8GlaWZis+HuXiv9EYv+gebv bg3I/zUOB75PlBgpKkKufRs1/JMH2dVd3y7Yn7hXJs4ysthes2EAvm3ggc+Lwlm9 42xMigY23r0tba2Al7VLhCZ6lHqKTwFWrPxSzmac4u2tCq8wAwP+i1ImYdhgkJqW ZwTuNneINJeQN8WtyipU =4Q6R -----END PGP SIGNATURE----- --=-=-=-- From unknown Mon Aug 18 17:54:50 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: =?UTF-8?Q?G=C3=B6ran?= Weinholt Subject: bug#14864: closed (Re: bug#14864: bitwise-arithmetic-shift-right is wrong for large shift amounts) Message-ID: References: <87hafx55wf.fsf@tines.lan> <87a9lpdsyw.fsf@industria.weinholt.se> X-Gnu-PR-Message: they-closed 14864 X-Gnu-PR-Package: guile Reply-To: 14864@debbugs.gnu.org Date: Sun, 14 Jul 2013 18:55:07 +0000 Content-Type: multipart/mixed; boundary="----------=_1373828107-21565-1" This is a multi-part message in MIME format... ------------=_1373828107-21565-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #14864: bitwise-arithmetic-shift-right is wrong for large shift amounts which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 14864@debbugs.gnu.org. --=20 14864: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14864 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1373828107-21565-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 14864-done) by debbugs.gnu.org; 14 Jul 2013 18:54:56 +0000 Received: from localhost ([127.0.0.1]:54257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyRRe-0005bR-Ow for submit@debbugs.gnu.org; Sun, 14 Jul 2013 14:54:55 -0400 Received: from world.peace.net ([96.39.62.75]:51587 ident=hope0) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyRRY-0005b9-Kn for 14864-done@debbugs.gnu.org; Sun, 14 Jul 2013 14:54:49 -0400 Received: from 209-6-120-240.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com ([209.6.120.240] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UyRRS-0003uW-6S; Sun, 14 Jul 2013 14:54:42 -0400 From: Mark H Weaver To: =?utf-8?Q?G=C3=B6ran?= Weinholt Subject: Re: bug#14864: bitwise-arithmetic-shift-right is wrong for large shift amounts References: <87a9lpdsyw.fsf@industria.weinholt.se> Date: Sun, 14 Jul 2013 14:54:24 -0400 In-Reply-To: <87a9lpdsyw.fsf@industria.weinholt.se> (=?utf-8?Q?=22G=C3=B6r?= =?utf-8?Q?an?= Weinholt"'s message of "Sun, 14 Jul 2013 18:08:55 +0200") Message-ID: <87hafx55wf.fsf@tines.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 14864-done Cc: 14864-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: 0.0 (/) G=C3=B6ran Weinholt writes: > bitwise-arithmetic-shift-right from (rnrs) is wrong for ridiculously > large shift amounts: > > scheme@(guile-user)> (import (rnrs)) > scheme@(guile-user)> (bitwise-arithmetic-shift-right -2 (+ (greatest-fixn= um) 1)) > $1 =3D -2 > > The correct result is -1. Thanks for the report. Now fixed in stable-2.0. http://git.savannah.gnu.org/gitweb/?p=3Dguile.git;a=3Dcommitdiff;h=3D7e8166= f5bdb526c021c826943aaf050134cccc83 Mark ------------=_1373828107-21565-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 Jul 2013 16:14:19 +0000 Received: from localhost ([127.0.0.1]:54094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyOwE-0007BB-V9 for submit@debbugs.gnu.org; Sun, 14 Jul 2013 12:14:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55123) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UyOwC-0007Af-K7 for submit@debbugs.gnu.org; Sun, 14 Jul 2013 12:14:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyOw6-0006TB-Cy for submit@debbugs.gnu.org; Sun, 14 Jul 2013 12:14:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-99.2 required=5.0 tests=BAYES_50,T_DKIM_INVALID, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyOw6-0006T7-AR for submit@debbugs.gnu.org; Sun, 14 Jul 2013 12:14:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyOw5-0006ee-Cx for bug-guile@gnu.org; Sun, 14 Jul 2013 12:14:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyOw4-0006Su-Ck for bug-guile@gnu.org; Sun, 14 Jul 2013 12:14:09 -0400 Received: from iustitia.weinholt.se ([2a02:28f0:0:a::7dce:e5a8]:36496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyOw4-0006Sl-0m for bug-guile@gnu.org; Sun, 14 Jul 2013 12:14:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=weinholt.se; s=iustitia2012; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=kzPX8ifyIvmJS93g/Gi7F4CRB+1iRBScqiuldej9MEM=; b=laXnN+D3C7TllouSdZTcoft67F4NSySjJnYIgkB8a4lNj/zyaIik7PGKNLGxA6sDPsP649WQHUFdT3wOYe/bUDiyAYQmSUgAPPTugabDDfqYSZskeevddX4DnpvKlDhOBZbt12/rNUczVZmiHBXLo1RuiNZLcvyr/i8E3AgjES9vhhA9PqoC4Iu2eVOlndmOIFfC2zTIvW3MjLCsrKxMqBHAtLJWKK94CQpveGOArrVt+KJwDpGuiBCxInBu7drW3UKGDb3GjM/RAocnTRoyliz2GiqXsknxHvK3JtwxoSTdWcx7yXs96ap2SelFDalYVx8WnNfqsq3OE0WuAfr3tA==; Received: from uucp by iustitia.weinholt.se with local-bsmtp (Exim 4.72) (envelope-from ) id 1UyOw2-0006Pe-Li; Sun, 14 Jul 2013 18:14:06 +0200 Received: from weinholt by industria with local (Exim 4.80) (envelope-from ) id 1UyOr2-00056P-7p; Sun, 14 Jul 2013 18:08:56 +0200 X-Hashcash: 1:20:130714:bug-guile@gnu.org::PGDspBnhoqf+sq8s:000000000000000000000000000000000000000000004wSM From: =?utf-8?Q?G=C3=B6ran?= Weinholt To: bug-guile@gnu.org Subject: bitwise-arithmetic-shift-right is wrong for large shift amounts Date: Sun, 14 Jul 2013 18:08:55 +0200 Message-ID: <87a9lpdsyw.fsf@industria.weinholt.se> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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.0 (-----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello schemers, bitwise-arithmetic-shift-right from (rnrs) is wrong for ridiculously large shift amounts: scheme@(guile-user)> (import (rnrs)) scheme@(guile-user)> (bitwise-arithmetic-shift-right -2 (+ (greatest-fixnum= ) 1)) $1 =3D -2 The correct result is -1. Tested on an amd64 system with guile-2.0.9.20-10454-dirty. Here are a few more failing cases, if it helps: (bitwise-arithmetic-shift-right -1939573486025768832 1842615318141600354) =3D> =2D112898036 ; *** failed *** ; expected result: -1 (bitwise-arithmetic-shift-right 1344211617424411880 1877595747324902264) =3D> 18 ; *** failed *** ; expected result: 0 (bitwise-arithmetic-shift-right -1152921504606846979 88553614889043251) =3D> =2D513 ; *** failed *** ; expected result: -1 (bitwise-arithmetic-shift-right -870600743868926059 1508151148) =3D> =2D49488 ; *** failed *** ; expected result: -1 Regards, =2D-=20 G=C3=B6ran Weinholt 13 MR. JAKES: I think our economy was based on 14 industrial process. 15 JUSTICE SCALIA: It was based on horses, for 16 Pete's sake. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCgAGBQJR4s0XAAoJEOM+YaLpuMOi9OwP/ApHe0ZvvWYaUWh9Ay3TFoo9 iGMgI8NCcbhqeSUYsDwGdf9PAPr8zzmJEHud7a7ghHgtmGcAOKxYNF2LkzplE+pG ICybtZxkyHvo6Ta71QguUrGR9Ezk7idsdmWvhjMmN0Xz1C9Y5+qdflNcP1uoP8Jq ywfX8VnvLIzjiWgpvfyi+rZnYSDiKgFZOF/RiFSJMppxy5M61rTtSe1gSfZjRq4v FNWZ/zZacXbCWV6/DbTgAgm5olDGlnA4hRBXQJm4l9QTykJxGFmrmRYsNyOmS8ZV kl+WJPP9YE4LehHFtianbinU7eZaRv6ZZMmyqGi41F543i5K9z2vhHAk035b8wj2 BPNehxcMh+EHTMV3sSxh1dVK9Rsyy6YE5em14YeDvUP2BoRlRLFc/e30BuZgUOCM tQ+FQy7m9QjAOqRGf/flmxVxEEqsryx30IKMmlWSHEho+NmPKxRKglhaxNwGA4NB pjqy86r5QZ84wCZ6+SHg+RF036N274xG+q7OX6aQu8GlaWZis+HuXiv9EYv+gebv bg3I/zUOB75PlBgpKkKufRs1/JMH2dVd3y7Yn7hXJs4ysthes2EAvm3ggc+Lwlm9 42xMigY23r0tba2Al7VLhCZ6lHqKTwFWrPxSzmac4u2tCq8wAwP+i1ImYdhgkJqW ZwTuNneINJeQN8WtyipU =4Q6R -----END PGP SIGNATURE----- --=-=-=-- ------------=_1373828107-21565-1--