[racket] Bug with equal? and bit-vectors

From: George Neuner (gneuner2 at comcast.net)
Date: Thu Feb 26 02:25:42 EST 2015

On Tue, 24 Feb 2015 23:13:48 +0100, Jens Axel Søgaard
<jensaxel at soegaard.net> wrote:

>2015-02-24 23:01 GMT+01:00 Eric Dong <yd2dong at uwaterloo.ca>:
>> It seems that bit-vectors have a really weird bug, where short bit-vectors
>> that aren't equal will often return true when tested with equal?.
>>
>> Here's a trivial example:  http://pasterack.org/pastes/35137
>>
>> Is this a known bug? It shouldn't be hard to fix; the equality tester just
>> needs to, umm, do its thing properly? The bug is very annoying and caused a
>> lot of headache in a certain application of mine, since the false equality
>> does things like breaking hashtables unexpectedly, etc.
>>

>Hi Eric,
>
>I vaguely remember this bug being fixed some time ago,
>and since I get #f on here on version 6.1.1.8 I suspect
>you can fix the problem by upgrading.
>
>Which version of Racket do you use?
>
>/Jens Axel

It's still in the 6.1.1 release.  

I played with it a little: if the two bit-vectors have equal length
and the length is <= 8, then equal? always returns #t ... the values
of the elements seem to be ignored.

George


Posted on the users mailing list.