emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#21901: closed (bit shift wrong on maximal right sh


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#21901: closed (bit shift wrong on maximal right shift)
Date: Sun, 14 Oct 2018 09:42:02 +0000

Your message dated Sun, 14 Oct 2018 05:40:51 -0400
with message-id <address@hidden>
and subject line Re: bug#21901: bit shift wrong on maximal right shift
has caused the debbugs.gnu.org bug report #21901,
regarding bit shift wrong on maximal right shift
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
21901: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21901
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: bit shift wrong on maximal right shift Date: Fri, 13 Nov 2015 10:22:03 +0000
With Guile 2.0.11:

scheme@(guile-user)> (ash 123 (ash -1 63))
$1 = 123

Correct result would of course be zero.  Problem only occurs for
exactly this shift distance: one bit less produces the right answer.
Problem also occurs on Guile 1.8.8.  Looking at the implementation,
the problem is attributable to the negation of the shift distance,
which in twos-complement fails to produce the expected positive result.

Note the resemblance to bug #14864, fixed in 2.0.10.  This bug is of
very similar form, but is distinct.  The test cases of #14864 pass for
me on the 2.0.11 that shows the problem with a 2^63 bit shift.  My bug
does occur with the rnrs bitwise-arithmetic-shift-right, which was used
in #14864, as well as with ash.

-zefram



--- End Message ---
--- Begin Message --- Subject: Re: bug#21901: bit shift wrong on maximal right shift Date: Sun, 14 Oct 2018 05:40:51 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Zefram <address@hidden> writes:

> With Guile 2.0.11:
>
> scheme@(guile-user)> (ash 123 (ash -1 63))
> $1 = 123
>
> Correct result would of course be zero.  Problem only occurs for
> exactly this shift distance: one bit less produces the right answer.

Nice catch!

It's finally fixed in commit 1990aa916382d0afcebd5315a6d6f555949ff654 on
the stable-2.2 branch.  The fix will be in Guile 2.2.5.

Thanks for the report.

      Mark


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]