How To Represent a Negative Binary Number Using Two's Complement Fast Method

preview_player
Показать описание

Learn the fast way to use two's complement to represent a negative binary number with any number of bits
Рекомендации по теме
Комментарии
Автор

For those of you who are confused about WHY HE CHOSE 5 its FOR 2 and 6 bits FOR 14, he did it sort of randomly. He only needs enough bits to perform the 2 and -2. So he really only needed 3bits and 5 bits for 14 and -14.
2 = 010 14 = 01110
-2 = 110 -14 = 10010

summarise:
with 3 bits in 2's compliment you can get numbers between 3(011) and -4(100)
with 4 bits in 2's compliment you can get numbers between 7(0111) and -8(1000)
with 5 bits 15(01111) and -16(10000)

notes:
with 8 bits representation of
between and

which means with with 1 bit you can only represent 0(0) and -1(1) as 1 would be (01)

MJin
Автор

Fast vid to learn a Fast trick and didn't ask me to like the vid.. That's why you get a like sir !

TOthaknee
Автор

@Mrsfaaraa there are many ways to represent negative numbers, you could even come up with your own. One way is two's compliment another, the one you are describing, is called sign magnitude. In sign magnitude, from left to right, the first bit tells you the sign and the rest tell you the magnitude, if the first bit is 1 the number is negative. Example: 10011=-3, 00011=+3

AllAboutEE
Автор

@unholyjebus The point of the fast method is that you dont even have to think about adding the one, that would be the slow method. Like I said, going from right to left everything after the first one gets inverted. I guess I should say that the one was implicitly added this way.

AllAboutEE
Автор

Thank you~! This is faster than the invert everything and add thing my professor showed us. Here's hoping I do well if it comes up on the final. :3

TechnologyWitch
Автор

Well for example, you might come across the word 'signed' and 'unsigned' numbers. If you are programming and you say 'this 4bit number has to be unsigned', and your number is '1011', it means '8 + 2 + 1 = 11'. If you say it's signed, you are saying the number can be negative. This means that same '1011' will actually mean '-3'. The bit on the left says '1' and in signed numbers, that left '1' means it's negative.

This means the computer doesn't know the difference until you give it the info

BrQtje
Автор

Because YOU decide for the computer. In other words you interpret the data however you decide (based on number of bits, negative convention code etc). You as the etc. should know that convention is been used.

Computer's don't really "decide" or "know", all they do is show us what we ask them to.

AllAboutEE
Автор

I said "going from right to left, invert the bits after the first 1 you encounter". In other words: starting from the right, move the to the left and invert the bits that are to the left of the first 1 you see.

AllAboutEE
Автор

For those of you confused of how to go from 110010 to -14. The first bit is a flag set to say that its a negitive. The rest is the difference between its worth and its potential worth. So its worth is 10010 = 34. Its portential worth is = 48. 34 - 48 = -14
Please someone correct me as I just saw this pattern and not sure if I am correct.

alexroberts
Автор

thanks man.... that was straight to the point

MegaPruddy
Автор

Thanks, only after this tutorial I understood why the value is -3 in decimal. The value was returned by the bitwise negation operation in PHP ($a = 2; $b = ~$a; echo $b;)

DK-crhn
Автор

Im confused, he said invert the numbers after the first but in both examples he left the first two the same

Blackgd
Автор

in my pc 11110 is in decimal 30!? do i misunderstand something?

Turjak_art
Автор

im not sure how u can cone up with the nukber of bit: like -2 is 5 bits, -14 is 6 bits ....

nguyentuan
Автор

how can someone tell the difference between -2 and 30 (I am using the example you have used)

ethangoldwyre
Автор

wao thats so easy..thank u so much sir

divyajain
Автор

How can u be so careless ? We are interested in getting 2's complement of two number. (i) -2 (ii) 2 i.e. any number number and it's negation.

mrkunalgoswami
Автор

can anybody tells me how to calculate no. of bits required to store a particular amount GB data?

Jatin
Автор

Totally Amazing, your tutorial is better than my teacher's

chs
Автор

Thank you sir, this video really helped me to have a quick way of solving problems.
But I have a doubt...

If I wanna represent, -1 (Minus one) in binary numbering system, According to your method of inverting every thing after the first one, from right to left, would end up with but my book says that it should be
So would you please be kind enough to explain me, how this really works ?

Thank you and May God bless you :)

Mrsfaaraa
visit shbcf.ru