Why can't I xor strings?

Grant Edwards grante at visi.com
Mon Oct 11 18:25:26 EDT 2004


On 2004-10-11, Jeremy Bowers <jerf at jerf.org> wrote:
> On Mon, 11 Oct 2004 19:35:55 +0000, Grant Edwards wrote:
>
>> I don't know what you mean.  Two's compliment, one's
>> compliment, signed-magnitude, and excess-N _all_ use a single
>> bit for sign.
>
> I meant a single bit exclusively for sign, such that 
>
> 1 00001001
>
> and 
>
> 0 00001001
>
> are the same absolute value. The complements don't work that
> way. I guess that does leave a question for whether 1 is
> positive or negative, but for the purposes of my point, that
> doesn't matter much.

OK, if you meant signed-magnitude, you should have said that. ;)

AFAICT, the only people that use signed-magnitude for _integer_
quantities [IEEE FP representations are signed-magnitude] are
the analog guys who design A/D converters [and somebody needs
to slap them and tell them that out in the real world we want
2's compliment].  

I haven't _ever_ seen a signed-magnitude integer ALU, but I'm
sure some existed back before I started doing this sort of
stuff 25 years ago.

-- 
Grant Edwards                   grante             Yow!  My TOYOTA is built
                                  at               like a... BAGEL with CREAM
                               visi.com            CHEESE!!



More information about the Python-list mailing list