[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21901: bit shift wrong on maximal right shift
From: |
Andy Wingo |
Subject: |
bug#21901: bit shift wrong on maximal right shift |
Date: |
Mon, 20 Jun 2016 18:02:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
On Fri 13 Nov 2015 11:22, 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.
> 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.
Fascinating, thank you! Also occurs on 2.1.3.
Andy
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#21901: bit shift wrong on maximal right shift,
Andy Wingo <=