Binary 2 - Two's Complement Representation of Negative Numbers

  Рет қаралды 121,326

Computer Science Lessons

Computer Science Lessons

Күн бұрын

Пікірлер: 152
@swedishguyonyoutube4684
@swedishguyonyoutube4684 3 жыл бұрын
I am humbled by how pedagogical, clear and efficient you are in teaching this material. I'm a former teacher switching careers to work in IT, and your videos have been incredibly helpful and instructive. Thank you very, very, much!
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
You're very welcome and thank you so much. I too switched from teaching to IT, but I came back to teaching again. :)KD
@talharashidi366
@talharashidi366 6 жыл бұрын
this is easily the best video on youtube for learning 2's complement.
@ComputerScienceLessons
@ComputerScienceLessons 6 жыл бұрын
You are very kind. Tnx :)
@ApteraEV2024
@ApteraEV2024 Жыл бұрын
I❤u 2's!!❤🎉
@oliver4003
@oliver4003 3 жыл бұрын
so I spent hours reading this section in my textbook trying to understand it with no luck. So i decided to watch this video, and 12 minutes later I fully understand the concept. Thank you so much!
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
You are very welcome - glad to help :)KD
@Jayson223ad
@Jayson223ad 5 жыл бұрын
I have exam in Discrete mathematics in a few days and this is one of many topics. I knew how but not why. Thank you so much for making this so so clear. My teacher never explained the first 1 stands for -128! nor the book or notes . If all the teachers were like you the civilization would be much more advanced.
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
You are most welcome :)KD
@rancorjoy5412
@rancorjoy5412 Жыл бұрын
I do not think the first number stands for -128! ~ -3.856205e+215
@T3chBeatz
@T3chBeatz 6 жыл бұрын
Kevin's delivery of these tutorials is just brilliant - Thank you!
@adamyagaur9638
@adamyagaur9638 2 жыл бұрын
This is learners gold. Short , crisp & clear . Thanks a lot!.
@ComputerScienceLessons
@ComputerScienceLessons 2 жыл бұрын
Thank you :)KD
@TheLonelyLPer
@TheLonelyLPer 3 жыл бұрын
This is hands down the best explanation I've had for 2's complement! Thank you!
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
You are very welcome :)KD
@cesarvides9729
@cesarvides9729 4 жыл бұрын
Just when I thought I had learned an easy method, you pull out another one. This video had me on an emotional rollercoaster.
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
I hope it was the exciting part of the ride. :)KD
@exactzero
@exactzero 4 жыл бұрын
Awesome explanation. You didn't just teach the how but also the why which is the most important of all. That last technique was mind-blowing!
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
Thanks for the comment. Delighted to help. :)KD
@veryangerymanminecraftisco9048
@veryangerymanminecraftisco9048 5 жыл бұрын
Thank you so much dude, I never mange to find people who speak English on youtube that teach these sort of thing.
@potatochannel1948
@potatochannel1948 Жыл бұрын
-Sir, you are a saver, my prof at the university only gave us the two's complement method without explaining where the hell that came from . I very thankful for you sir!
@fmv5370
@fmv5370 10 күн бұрын
clear explanation in all topics in the playlist about binary and denary representations for both integers and floating point numbers, thanks for your effort.
@ComputerScienceLessons
@ComputerScienceLessons 7 күн бұрын
You're very welcome :)KD
@boudieraurelien8531
@boudieraurelien8531 5 жыл бұрын
To be honnest, if you were in front of me, i'd have hug you ! You just made me so happy, i finally understood why i can use the 2's complement. I didnt understand why i had to use it. Thank you soooo much!
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
You are welcome. Things are much easier to understand when you know why! :) KD
@nicestcatoutthere3221
@nicestcatoutthere3221 5 жыл бұрын
This was truly the best video on complements.
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
Thanks for the lovely comment :) KD
@rationalsage1084
@rationalsage1084 4 жыл бұрын
This is an incredible insight, I've never understood this, my teacher only taught me the shortcut to the conversion.
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
Underlying concepts are important if you want knowledge that you can build upon. Thanks for the comment :)KD.
@amanrubey
@amanrubey 4 жыл бұрын
your videos are simply superb. it's the same as watching some interesting documentary. I'm loving it. True Gem on the internet
@guzman-do
@guzman-do 7 жыл бұрын
What a great teacher you are, Sir!
@ComputerScienceLessons
@ComputerScienceLessons 7 жыл бұрын
You are too kind.
@sandipghoshal2122
@sandipghoshal2122 4 жыл бұрын
This so far the best video on two's compliment
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
Thanks for saying so. :)KD
@xr.melissa
@xr.melissa Жыл бұрын
Excellent video! My coworker was trying to teach this to me but it's hard to follow without strict examples, so thanks for this!
@ComputerScienceLessons
@ComputerScienceLessons Жыл бұрын
You are most welcome :)KD
@jworld9
@jworld9 4 жыл бұрын
Thank you so much. Why the universities cannot make their material as easy as this? Thank you millions!
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
You are very welcome. Thanks for the comment. :)KD
@deedewald1707
@deedewald1707 3 жыл бұрын
You are confident and capable to teach complex concepts !
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
Thank you. I've been doing it for nearly 40 years :)KD
@deedewald1707
@deedewald1707 3 жыл бұрын
@@ComputerScienceLessons I put this method into Excel such as your teacher skills are excellent !
@LindaLawton
@LindaLawton 7 жыл бұрын
You might want to add a link to the first series in the description. Make it easier for me to go check that one out :)
@blank-vw2sb
@blank-vw2sb 6 жыл бұрын
AWESOME, i don't find this depth in two's complement. Really Nice
@flow_down_iana
@flow_down_iana 2 жыл бұрын
Oh my Godness. It's so great explained. I find it just wondersfull so you can pause the video or watch this one more time till you get the idea...not like at the uni.
@ComputerScienceLessons
@ComputerScienceLessons 2 жыл бұрын
I very am glad to hear this is useful. There is a lot to be learned at university too. :)KD
@abhishekdutta8089
@abhishekdutta8089 4 жыл бұрын
Thank you sir for this wonderful lecture on representation of binary numbers.
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
You are very welcome. Thanks for commenting :)KD
@MrMeeseeksPiano
@MrMeeseeksPiano 2 жыл бұрын
You say that I can represent up to 256 positive numbers with 8 bits but then doesn't specify wether the MSB is -128 or 128 for the exercise at 8:03? Was I supposed to guess it?
@ComputerScienceLessons
@ComputerScienceLessons 2 жыл бұрын
The left most bit is -128 as described earlier in the video. The left most bit is always a negative value with two's complement.
@soz824
@soz824 5 жыл бұрын
Great voice, super well made video and excellent explanation!
@fadhlyrafi
@fadhlyrafi Жыл бұрын
3:09 how about 2s complement table for 16 bit binary?
@ehsanmavaei5380
@ehsanmavaei5380 5 жыл бұрын
Awesome people like you who help people understand better are loveable and admirable
@v380riMz
@v380riMz 3 жыл бұрын
Bruh this becomes so easy when you know that MSB should be -128 for negative binary numbers
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
That's the trick 💡:)KD
@user-fg6ng7ej6w
@user-fg6ng7ej6w 9 ай бұрын
very clear explanation. cool that you presented 2 ways of dealing with it
@ComputerScienceLessons
@ComputerScienceLessons 8 ай бұрын
Thank you :)KD
@alexmartini8087
@alexmartini8087 3 жыл бұрын
At 11:35 for the example -44: how does the 3rd bit go from 0 + 0 = 1, but the 4th bit goes from 0 + 0 = 0?
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
With the third pair of bits there is a 1 carried from the previous pair. With the 4th pair of bits, there is no carry. Take at look at this: kzbin.info/www/bejne/iom9c6Sqm6aCprs :)KD
@hammam92
@hammam92 6 жыл бұрын
The best video on KZbin, Thanks so much
@ComputerScienceLessons
@ComputerScienceLessons 6 жыл бұрын
Thank YOU
@kenshinhimura8708
@kenshinhimura8708 4 жыл бұрын
Thank you so much! Why can’t textbooks explain it the way you did from 0:00-7:00?
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
I'm happy to help. Thanks for the comment. :)KD
@astheffander_alexander
@astheffander_alexander 4 жыл бұрын
Got stuck because of the "online class" didn't help me.... But this video help sooooooo muchhh... Thanks!!! 😭
@ghalibazad5961
@ghalibazad5961 3 жыл бұрын
How did you subtract 38 from 90...can you explain? At 2:09 .....
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
Column subtraction in base 10 is explained here www.bbc.co.uk/bitesize/topics/zy2mn39/articles/zc78srd :)KD
@ghalibazad5961
@ghalibazad5961 3 жыл бұрын
@@ComputerScienceLessons thanks
@fatimakhan3084
@fatimakhan3084 3 жыл бұрын
Best teacher ever!!!
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
Wow - thanks :)KD
@mmmpz2298
@mmmpz2298 Жыл бұрын
You safe me from failed the test😭 thank you so much😭
@mahmoudbasha4838
@mahmoudbasha4838 2 жыл бұрын
sir great work i spent a week to try to understand this topic but thanak to u it's done.. i wanna know sir what is the program u using to make these effects in the videos
@NoName-tj8dm
@NoName-tj8dm 2 жыл бұрын
Thanks for the great video. I am confused how system will be able to identify that left most bit is -128 of the bit is 1
@rx25251
@rx25251 3 жыл бұрын
Can you please explain how the computer identifies a number as a negative number before storing it in registers in its 2s complement form ? How does the computer know the result of arithmetic operation is negative so that it can be stored in its 2s complement form.
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
Hi Ravi, a computer system stores POSITIVE numbers in two's complement as well. So that fact that it is negative, or positive, is part of the encoding. Ultimately, negative numbers come from outside the computer. When you input a negative number, you probably type a minus sign in front of it, the value you have input is then processed and stored accordingly. When it comes to arithmetic operations such as addition and subtraction, negative results take care of themselves (that's the beauty of two's complement) as you will see if you study floating point addition and subtraction later in this series. By the way, in this series, I am talking about general principles used by a range of different types of computer system. Modern PCs encode floating point numbers using the IEEE 754 standard, but the same arguments apply. :)KD
@rx25251
@rx25251 3 жыл бұрын
Thanks for the explanation! One follow-up question however - How do you represent a positive number in its two's complement form ? For example +57 in binary is 00111001 and two's complement of 00111001 is 11000111 So will the two's complement of +57 i.e., 11000111 be stored in the registers ? But the first bit is 1 which denotes a negative number. 11000111 from above is in fact binary representation of -57 and its 2's complement is 00111001 . what will be stored in the registers to represent -57 ?
@akshaybodla163
@akshaybodla163 5 жыл бұрын
Im really confused about binary addition. I have a few questions that i hope you can answer, thanks! 1) At 10:03 why is there a subscript of 1 at the last zero? 2) And for -122 in binary why does the addition of 0 and 0 in the two's place create a 1? 3) When is the result a 0 or 1 when adding bits
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
When we perform a similar calculation in base ten, we add pairs of digits and, if necessary, we carry a digit. In the example below, 6 + 9 is 15 so we write down 5 and carry 1. The 1 is then added to 5 + 8. 4 5 6 +7 8 9 ___1___ 5 _______ In base ten, 1+1 = 2. We represent 2 in binary as 10, so 1+1 = 10. In my video, I write down the 0 and carry the 1. The green bits are the bits that are carried. In my example for -122, the the 1 that was carried from the previous operation is added to 0+0. I just haven't shown the carry bits this time. I hope this helps. will will make a quick video on how to add binary numbers together soon. KD
@tavongampofu9561
@tavongampofu9561 2 жыл бұрын
wow really helpful i was struggling with this for a while thank you
@ComputerScienceLessons
@ComputerScienceLessons 2 жыл бұрын
You're welcome :)KD
@HealthConsciousUpdates
@HealthConsciousUpdates 5 жыл бұрын
Thanks sir It's too much useful video👍👌 Love this video from Pakistan
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
Thank you :) KD
@thimalifernando7164
@thimalifernando7164 4 жыл бұрын
Awesome explanation. Thank you!
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
You are very welcome. :)KD
@АнатолийАнатолий-п1д
@АнатолийАнатолий-п1д 4 жыл бұрын
Very good video, sir.
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
Thank you kindly :)KD
@DigitalGuruLK
@DigitalGuruLK 7 жыл бұрын
what is the maximum negative number in two's complement... how it represent large negative numbers....?
@ComputerScienceLessons
@ComputerScienceLessons 7 жыл бұрын
That's where floating point binary comes to the rescue
@WesleyKanye
@WesleyKanye Жыл бұрын
Thank you for simplifying this
@LimeriuxasLT
@LimeriuxasLT 2 жыл бұрын
Awesome video!!! Thank you so much!
@ComputerScienceLessons
@ComputerScienceLessons 2 жыл бұрын
You're welcome, and thanks :)KD
@barrydevine
@barrydevine 3 жыл бұрын
Does the system whereby the MSB becomes a negative (ie -128) have a name?
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
It's called 'two's complement' :)KD
@barrydevine
@barrydevine 3 жыл бұрын
@@ComputerScienceLessons In this video you seem to have 2 methods of making negative numbers: 1 - changing the MSB to -128 2 - 2's complement. Am i mistaken?
@Mike-vj8do
@Mike-vj8do 3 жыл бұрын
hey man, what if we are asked to do it in 6 bits
@Mike-vj8do
@Mike-vj8do 3 жыл бұрын
instead of 8 bits
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
You might. The biggest number you could encode however would be 63 (64 possible values including 0). Perhaps there is an embedded system out there that only needs to work with integers up to 63. Some types of processor might allocate 6 bits of the current instruction register to the operation code, which means a maximum of 64 commands in the instruction set (as you'll see if you start looking into hardware architecture and low level code). :)KD
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
see below
@monjasonsteng7861
@monjasonsteng7861 Жыл бұрын
Thank you. This was great!
@ComputerScienceLessons
@ComputerScienceLessons Жыл бұрын
You're most welcome :)KD
@SuperSayiyajin
@SuperSayiyajin 5 жыл бұрын
Thanks for your playlist.
@TheAltKryptonite
@TheAltKryptonite 4 жыл бұрын
This video is awesome, thank you!
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
Thank you for the awesome comment. :)KD
@AviPars
@AviPars 3 жыл бұрын
what about positive binary to 2s complemenmt
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
Same method - just put a 0 in the left-most place value. In two's complement, positive numbers always start with 0 and negative numbers always start with 1. :)KD
@CraigEaton
@CraigEaton 6 жыл бұрын
This has confused me for YEARS and I have to teach this soon. This video just makes it so easy. I do have one question tho 1011 1011 How would one know which number is representing the negative?
@ComputerScienceLessons
@ComputerScienceLessons 6 жыл бұрын
By convention, the sign bit is the left most bit. Inside a processor register, one of the bits will be allocated as the sign bit, usually on the left, but it might vary from processor to processor. This is decided by the designers of the processor.
@АнатолийАнатолий-п1д
@АнатолийАнатолий-п1д 4 жыл бұрын
You just have to agree with whomever you talking to that you both use the same system. It's just like with character sets - it only works for you and your friends because you've agreed to use the same method of representation (encoding). If all of you will use different encodings (for example, like the ones before Unicode came along), you'll end up with the same binary numbers, but different interpretations of those (thus different characters).
@SusmitMohan
@SusmitMohan 7 жыл бұрын
Really very impressive work. Thanks a lot.
@ComputerScienceLessons
@ComputerScienceLessons 7 жыл бұрын
Tnx :)
@theonesongchannel9513
@theonesongchannel9513 4 жыл бұрын
Just Beautiful!
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
Thank you :)KD
@voiceoverworld4036
@voiceoverworld4036 5 жыл бұрын
Where does the green 1's come from?
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
They are the carry bits. 1 + 1 = 10, so write down the 0 and carry the 1.
@shah144
@shah144 2 жыл бұрын
How would u do -7.5?
@ComputerScienceLessons
@ComputerScienceLessons 2 жыл бұрын
Good question. You would need to use floating point binary. :)KD
@Technogrammer
@Technogrammer 7 жыл бұрын
Excellent Work Done!
@ComputerScienceLessons
@ComputerScienceLessons 7 жыл бұрын
:) Tnx
@oneminutedaily6394
@oneminutedaily6394 5 жыл бұрын
Which method is the best?
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
Two's complement lets you subtract a number by simply using addition. Sign and magnitude makes subtraction more difficult but is good for fast conversion.
@oneminutedaily6394
@oneminutedaily6394 5 жыл бұрын
@@ComputerScienceLessons thank you so much sir 👍🏼 keep it up with the good content provided. No doubt u're a hidden gem in youtube 😄
@lumennganje2721
@lumennganje2721 4 жыл бұрын
wonderful. thanks so much. God bless you
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
You are very welcome :)KD
@milestailsprower4555
@milestailsprower4555 2 жыл бұрын
127 is possible in 8 bit twos complement.
@ComputerScienceLessons
@ComputerScienceLessons 2 жыл бұрын
Indeed it is. The range is from -128 to 127 :)KD
@yangliyeh5510
@yangliyeh5510 4 жыл бұрын
Thanks a lot! Very clear!
@MTP2nd
@MTP2nd 7 ай бұрын
im from chile, if is -32'768 for 16-bit binary numbers, i would stay it as -32'768 since doing two's complement of -32'768 does nothing.
@osianpetts556
@osianpetts556 Жыл бұрын
11:59, is what you're looking for Osh
@idensoneltume627
@idensoneltume627 5 жыл бұрын
I was mind blown 🤯
@williamtylerwillis6417
@williamtylerwillis6417 2 жыл бұрын
Thank you!
@ComputerScienceLessons
@ComputerScienceLessons 2 жыл бұрын
You're welcome :)KD
@abdullateefjabasa1656
@abdullateefjabasa1656 3 жыл бұрын
How amazing you are!
@c_1_qw
@c_1_qw 3 ай бұрын
Thx for helping bruh 🎉
@Gravityys
@Gravityys 5 жыл бұрын
Denary = Decimal for those who don't know
@Gravityys
@Gravityys 5 жыл бұрын
Great video btw,really helping me grasp the basics of cs and understand them.
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
Glad to be help :) KD
@kavereon
@kavereon 4 жыл бұрын
holy...moly. I understand!
@ComputerScienceLessons
@ComputerScienceLessons 4 жыл бұрын
That's music to my ears. :)KD
@ThePandaGuitar
@ThePandaGuitar 6 жыл бұрын
Fascinating!
@indikajayasinghe9579
@indikajayasinghe9579 3 жыл бұрын
best of best
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
Thank you :)KD
@Democracy_Manifest
@Democracy_Manifest 3 жыл бұрын
Why this was published on April Fool's day I'll never know. Great video tho
@ComputerScienceLessons
@ComputerScienceLessons 3 жыл бұрын
It's hard to believe it was nearly 4 years ago. What a fool I was then! Thanks BTW. :)KD
@MusaYmc
@MusaYmc 6 жыл бұрын
you are a saint
@Kenzo-0-
@Kenzo-0- 6 жыл бұрын
Ty a lot
@ComputerScienceLessons
@ComputerScienceLessons 6 жыл бұрын
You're welcome
@ryanalnaser914
@ryanalnaser914 3 жыл бұрын
thanks for anything or where I stop
@mari-oz4bs
@mari-oz4bs 5 ай бұрын
you are an angel i love you
@ComputerScienceLessons
@ComputerScienceLessons 4 ай бұрын
Thank you :)KD
@phy_dude
@phy_dude 5 жыл бұрын
❤️
@Redheadredification
@Redheadredification 5 жыл бұрын
I love you
@ComputerScienceLessons
@ComputerScienceLessons 5 жыл бұрын
Love U 2 KD
@ToanPham-wr7xe
@ToanPham-wr7xe Жыл бұрын
😮
Binary 3 - Fixed Point Binary Fractions
6:46
Computer Science Lessons
Рет қаралды 60 М.
Twos complement: Negative numbers in binary
13:49
Ben Eater
Рет қаралды 1,2 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
1's complement and 2's complement | Signed Binary Numbers Explained
16:54
ALL ABOUT ELECTRONICS
Рет қаралды 267 М.
Binary Addition and Subtraction With Negative Numbers, 2's Complements & Signed Magnitude
24:57
Two's Complement
23:20
Caleb Curry
Рет қаралды 76 М.
The sequence that grows remarkably large, then drops to zero!
17:28
Binary 1 - Converting to and from Denary
9:31
Computer Science Lessons
Рет қаралды 97 М.
How are Redstone Computers even possible?
19:36
Ellie Rasmussen
Рет қаралды 369 М.
How Floating-Point Numbers Are Represented
9:56
Spanning Tree
Рет қаралды 41 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
The Doomsday Algorithm - Numberphile
14:33
Numberphile
Рет қаралды 858 М.