An Idiots Guide


Recommended Posts

leave the leading number as is...

00010011 <-- the first 1[as in the number 1] from the right>left direction [unless its a 0 then you contintue till you come to the first 1...]

changes to this...

11101101 we keep the leading 1 and from there you work out the binary...

anything else or?

Link to comment
Share on other sites

Or, even more simply stated...

- Look at the last 1 in the number (for example, 11001001).

- Leave that 1 alone and flip everything before that (i.e., 0's become 1's, 1's become 0's).

So, our example, after two's compliment, becomes 00110111.

Link to comment
Share on other sites

hello im back, now im realy stuck with pointers in C, so im off to post in the Programming forum unless anyone can help me with that, id like to chat to the on MSN if anyone can help. Thanks for all the help anyway its just ive got a test on Monday and i need to get at least 35 percent to pass. So im going to be revising **** loads for it. Thanks guys for the help.

Link to comment
Share on other sites

ANSWER:

If you are adding two numbers, don't change ANYTHING! Just add them! 01 + 01 = 10! you ONLY change something if you are going to SUBTRACT it.

For instance...

5 - 1

simple enough?

5 = 101

1 = 001

because you are subtracting 001, flip it around (110) and add 1 (111)

now add the two number together, 101 + 111 = 1,100

wow, if you take that last 1 off, you get 4, tada!

want to see it again?

95 - 40 (hey, we just gots to use bigger numbers)

95 = 1011111

40 = 0101000

notice, you must make both numbers the same number of bits (just add 0's)

flip the 40 (1010111) and add 1 (1011000)

1011111 +

1011000 =

10110111

now you have , , , 55! cool, eh.

Notice I only added 1 to it each time. I believe you add 2 for 2's compliment. I believe I just showed you 1's compliment.

Wew :blink:

Link to comment
Share on other sites

Notice I only added 1 to it each time. I believe you add 2 for 2's compliment. I believe I just showed you 1's compliment.

Wew :blink:

No, you did it correctly. With 1's compliment you simply flip all the bits, with 2's compliment you add 1.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.