-
somebody help
Hello all. I'm having a horrible time studying binary numbers I already know the following
1+0=1
0+1=1
0+0=0
1+1=10
which is all well and good but what happens when I get someting like this
1+1+1+1+1+1=?
The proffessor I believe thinks that we know this stuff already so he doesn't explain what to do in these situations
for instance we were doing some binary muliplication and I ended up with something like this
1011011
1010111
1011100
1010000
^ this column right here is what I'm having problems with what do I add what do I carry over to the next column. ArggggggggggggH. I've been working on this for like one day now and I haven't got a clue
-
why dont you go and read your previous post instead of starting a new one asking the same question?
here it is http://cboard.cprogramming.com/showthread.php?t=62645 read the replies.
-
ok i got me a book on it i'll tell you this :
0 = 0000 0000
1 = 0000 0001
2 = 0000 0010
3 = 0000 0011
4 = 0000 0100
5 = 0000 0101
6 = 0000 0110
so 7 will be 0000 0111
etc etc etc .
so what I have learned from this is that its a '1' is added at the back , untill its 'full' then an new '1' is added at the place where the last number in the latest row was . so 1+1+1+1+1+1= 6
look 6 up in the collum i gave you and there you have your awnser :D
-
Add them in pairs
t = a + b
t = t + c
t = t + d
-
alrighty but
Okay but what do you when you are carrying to the next column I mean do you you carry all of the ones or keep the zero or what
-
> 1+1=10
1 + 1 is 0, carry 1
Have you ever done long addition in base 10?
Or did you just learn to press the + key on the calculator without any real understanding of how to add two numbers together
Example.
0011
0011 +
Working right-to-left, we do...
Step 1 is 1 + 1 = 0, and carry(1)
0011
0011 +
xxx0 carry 1
Step 2 is 1 + 1 + carry(1) = 1 + carry(1)
0011
0011 +
xx10 carry 1
Step 3 is 0 + 0 + carry(1) = 1 + carry(0)
0011
0011 +
x110 carry 0
Step 4 is 0 + 0 + carry(0) = 0 + carry(0)
0011
0011 +
0110 carry 0
-
when you get to the last bit of a byte and still have something to carry over, that 1 essentially just gets lost.
-
I knew that already
I already knew all of that my friend I'm talking about a bunch of ones stacked on top of one another, for integer addition its easy you just carry over but for binary addition its totally different and I don't have a clue on how its done.
here is an example of the question
>1101
>1001
>1011
>1111
+0111
as you can see there are like five ones on top of one another now for base 10 addition this is easy,but for binary addition I don't know how to go about using the carry bit for each operation
-
But if you knew, you would see that the base has nothing to do with it - decimal (or integer as you incorrectly call it) works exactly the same way as binary addition.
Add up all the values in a column, the column result is sum % 2, the carry is sum / 2, which you then propagate (as the carry) to one of the next columns.
Which if you break the problem down into only trying to add two numbers together at once is easy.
-
Salem is a good tutor, he is patient too. :)