counting matching bits / bitXnor
Paolo Bonzini
bonzini at gnu.org
Mon Dec 17 16:05:16 UTC 2007
Cees de Groot wrote:
> On Dec 17, 2007 1:49 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>>> 0 bitXnor: 0 -> -1
>> And what exactly is wrong with that?
>>
> err... I'd expect '1' here?
No. If you have arbitrary-precision integers, numbers like "infinitely
many ones plus something else" are negative; numbers like "infinitely
many zeros plus something else" are positive. 0 is infinitely many
zeros, -1 is infinitely many ones -- and XNORing each of the infinitely
many zeros with itself produces infinitely many ones, right?
The problem is that your bitstrings have a length beyond which all bits
should be considered zeros; integers have not.
I hope this is understandable...
Paolo
More information about the Squeak-dev
mailing list
|