I'm learning base 2 addition and subtraction in a udemy course for assembly.
However, I dunno what I'm doing wrong here.
100100001
-110011101
I get -110000100.
Every binary calculator on the web gives me -1111100
What am I doing wrong?
I'm learning base 2 addition and subtraction in a udemy course for assembly.
However, I dunno what I'm doing wrong here.
100100001
-110011101
I get -110000100.
Every binary calculator on the web gives me -1111100
What am I doing wrong?
Other urls found in this thread:
allaboutcircuits.com
youtu.be
twitter.com
binaries can't be negative
The math part, for starters
So am I doing the math correctly, just the concept of a negative binary shouln't exist?
Wow gee thanks user
You're subtracting a larger number from a smaller number.
shit it's been a while since I studied that but I think you're supposed to use two's complement?
anyway try looking up an academic course or book on the subject like Mano's Digital Design
>that fuckery in the first digits
If I were to calculated like that, 3 - 5 would be -8. Do and then add a - sign to result.
>What am I doing wrong?
Try doing a subtraction the same way for decimal numbers, where you subtract something large from something small. Are you doing anything in that procedure you are not doing here?
Bullshit.
You're confusing binary with what computers do.
You are absurdly stupid. When you carry over in base 2 you add 2, not 1, just as in base 10 you would carry over 10, not 1.
For the purposes of CE, (if you are doing CE and not a fucking mouthbreathing CS brainlet), you should think of adding and subtracting using ripple adders but using XOR rather than NAND, and using a borrowing rather carrying register.
I can already tell this is gonna be a good thread.
>When you carry over in base 2 you add 2, not 1,
hi ameritard
10 == 02
when will they fucking learn
binaries can't be negative
there are only two numbers, 0 and 1
there are no negatives loser
to the anons wondering about negative binary numbers, look up signed and unsigned
>not converting to HEX
its so much easier
+0001 0010 0001 = 121
- 0001 1001 1101 = 19D
121-19D = -07C = - 0000 0111 1100
>decimals cant be negative
?there are only 10 numbers 0-9
>there are no negatives loser
pretty solid thought process there friend
He's right, binary numbers aren't negative *in binary*. That's why there's different data types for signed and unsigned ints.
8 bits unsigned gives you a range of 0 to 256.
8 bits signed gives you a range of -127 to 127
>0 to 256.
0 to 255, sorry
...
do 2's compliment to the number you are subtracting and then add the 2 numbers together, if you end up with more digits in the end ignore the left most one
0-255
-128-127
fucking mongrels. how are people this retarded these days? unfucking believable, have any of you even gone through high school yet?
>He's right, binary numbers aren't negative *in binary*.
You mean that processors store negative numbers in bit patterns that still have a meaning as a positive binary number. But that doesn't mean that there cannot be negative binary numbers; OP is not calculating two's complement numbers here.
If you compute 0010 - 0110, the result of the subtraction is -100. Now this can be encoded in four-bit two's complement as 1100, but the result of the subtraction and the encoding of the negative result are two separate things.
I don’t know how to do binary subtraction.
Two’s complement the bottom number then add them.
>learning
If you already know arithmetic then you should've learned binary arithmetic in less time than it took you to make this thread.
Are you implying you haven't finished high school yet?
hi yurotard