Why can't I xor strings?

Jeremy Bowers jerf at jerf.org
Mon Oct 11 14:52:03 EDT 2004


On Mon, 11 Oct 2004 04:24:28 +0000, Grant Edwards wrote:

> On 2004-10-11, Jeremy Bowers <jerf at jerf.org> wrote:
> 
>> With respect, this isn't something to doubt or not doubt.
>> There is one, and only one, way to represent any positive
>> number in base two, since encoding sign is not an issue.
>> Assuming an extra bit to show sign, there is one and only one
>> way to represent any negative number, too.
> 
> That's news to me.  I've used three different base-2
> representations for negative numbers in the past week, and I
> can think of at least one other one I've used in the past.

I am aware of only one encoding that uses a single bit to represent sign,
as I stipulated, and discarding endianness issues I'm having a hard time
imagining what reasonable alternatives there are.

>> (Zero gets to be the exception since then you can have
>> positive and negative zero,
> 
> That depends on which base-2 representation you've chosen. In
> two's compiliment and excess-N representations, there is only
> one zero value.  In signed-magnitude there may be two.

I explicitly only discussed signed-magnitude: "Assuming an extra bit to
show sign".

Normally I'd exhort you to read more carefully but Bengt pointed out some
places I wasn't rigorous with my terms. :-) So I earned this.



More information about the Python-list mailing list