Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Winter 97 Question #2

0 views
Skip to first unread message

Marek Krzeminski

unread,
Feb 22, 1998, 3:00:00 AM2/22/98
to

Why is it that when you add 11001 to 11011 you get
-12 and not 20 ??

K Bains

unread,
Feb 22, 1998, 3:00:00 AM2/22/98
to

In article <EorKF...@watserv3.uwaterloo.ca>, "Marek Krzeminski" <mmak...@novice.uwaterloo.ca> wrote:
>Why is it that when you add 11001 to 11011 you get
>-12 and not 20 ??
>

May I ??

It seems that you are adding singed 2's complement If that is the case then
you must:

1) Add the two binary numbers (11001 is -7 and 11011 is -5).

2) Ignore the carry (in this case being the 6th bit in the result).

3) If the result is negative, then you must convert to a signed decimal
notation.

-7 + (-5) = -12
11001 + 11011 = 110100
/\
Ignore the bit!

Jim Field

unread,
Feb 23, 1998, 3:00:00 AM2/23/98
to

In article <EorKF...@watserv3.uwaterloo.ca>,
Marek Krzeminski <mmak...@novice.uwaterloo.ca> wrote:
>Why is it that when you add 11001 to 11011 you get
>-12 and not 20 ??
>
Because 5 bit 2-complement numbers can only represent -16 through +15.
After that the numbers "wrap around". See the picture on page 21
of the notes.

J Field

0 new messages