Discussion:
[racket] Bug with equal? and bit-vectors
Eric Dong
2015-02-24 22:01:11 UTC
Permalink
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.
Jens Axel Søgaard
2015-02-24 22:13:48 UTC
Permalink
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
Post by Eric Dong
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.
____________________
http://lists.racket-lang.org/users
--
--
Jens Axel Søgaard

____________________
Racket Users list:
http://lists.racket-lang.org/user
Greg Hendershott
2015-02-25 16:45:51 UTC
Permalink
I'd submitted a PR to fix this, on the old mono repo:

https://github.com/plt/racket/pull/756

Although the PR status is still "Open", actually it was merged to the
new racket/data repo in October (shortly after the repo split):

https://github.com/racket/data/commit/3653d4c561548f4bf00eefcfec5ad546516d62f5

I'm not sure if that would put it in the latest release, or you would
need a nightly build.
____________________
Racket Users list:
http://lists.racket-lang.org/users
George Neuner
2015-02-26 07:25:42 UTC
Permalink
On Tue, 24 Feb 2015 23:13:48 +0100, Jens Axel Søgaard
Post by Jens Axel Søgaard
Post by Eric Dong
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

____________________
Racket Users list
Ryan Davis
2015-02-26 20:57:51 UTC
Permalink
Post by George Neuner
On Tue, 24 Feb 2015 23:13:48 +0100, Jens Axel Søgaard
Post by Jens Axel Søgaard
Post by Eric Dong
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.
Please file a bug so it gets properly tracked.
____________________
Racket Users list
Robby Findler
2015-02-26 21:01:13 UTC
Permalink
Just in case anyone isn't clear on this, I believe there was a issue
on github that contained the fix and that has been put into the
development version of Racket already. Certainly the version of
DrRacket I've been typing into all day long gets the example at the
top of thread right.

Robby
Post by Ryan Davis
Post by George Neuner
On Tue, 24 Feb 2015 23:13:48 +0100, Jens Axel Søgaard
Post by Jens Axel Søgaard
Post by Eric Dong
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.
Please file a bug so it gets properly tracked.
____________________
http://lists.racket-lang.org/users
____________________
Racket Users list:
http://lists.racket-lang.org/user
George Neuner
2015-02-27 09:41:12 UTC
Permalink
On Thu, 26 Feb 2015 12:57:51 -0800, Ryan Davis
Post by Ryan Davis
Post by George Neuner
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.
Please file a bug so it gets properly tracked.
Done.

Greg and Robby believe it is fixed in the development version, but to
be safe I filed on the release version.

George

____________________
Racket Users list:
http://lists.racket-lang.org/users
Jens Axel Søgaard
2015-02-27 10:26:40 UTC
Permalink
FWIW It is this file and line:
https://github.com/plt/racket/blob/9de70551dcf0106c8d5494ccae5f173cd4457193/racket/collects/data/bit-vector.rkt#L183
Post by George Neuner
On Thu, 26 Feb 2015 12:57:51 -0800, Ryan Davis
Post by Ryan Davis
Post by George Neuner
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.
Please file a bug so it gets properly tracked.
Done.
Greg and Robby believe it is fixed in the development version, but to
be safe I filed on the release version.
George
____________________
http://lists.racket-lang.org/users
--
--
Jens Axel Søgaard

____________________
Racket Users list:
http://lists.ra
Continue reading on narkive:
Loading...