bitwise not - not what I expected

Michael Peuser mpeuser at web.de
Sun Aug 17 15:54:19 CEST 2003


"Elaine Jackson" <elainejackson7355 at home.com> schrieb im Newsbeitrag
news:d4L%a.781431$Vi5.17573533 at news1.calgary.shaw.ca...
>
> "Tim Peters" <tim.one at comcast.net> wrote in message
> news:mailman.1061098645.13097.python-list at python.org...
>
> <snip>
> | To understand your example above, note that
> | binary 10010 actually has an unbounded number of 0 bits "to the left":
> |
> |     ...00000010010 = 13

.. should read 18 BTW

> |
> | The bitwise inversion of that therefore has an unbounded number of 1
bits
> | "to the left":
> |
> |     ...11111101101 = -19
>
> ** What you're saying, the way I read it, is that 5+S=(-19), where S is
the
> (divergent) sum of all the powers 2^k of 2 with k>=5. I'm still at sea, in
other
> words.

I think not. Tim seems to point out that there is no natural final
"representation" of negative numbers unless we invent some convention. The
interpretation of 1101101 or 11111101101 or ......1111101101 as -19 is a
convention and has nothing to do with the more natural interpretaton of
101101 as 18. The main reason is that binary adders used in computers are
very simple too be (ab-) used for subtraction in that way....

Kindly
Michael P







More information about the Python-list mailing list