Twos complement: Negative numbers in binary

preview_player
Показать описание
How can we represent negative numbers in binary? There are several ways. This video compares using a sign bit, ones complement, and twos complement. Twos complement is the most commonly technique because it's relatively easy to implement in hardware and it makes addition and subtraction with negative numbers easy.

Рекомендации по теме
Комментарии
Автор

Please tell me you're a paid instructor, and that you're paid well. You deserve it! This isn't just a YouTube series, this is a full fledged course Thank you!!

DUANEYAISER
Автор

I probably had two's compliment taught to me half a dozen times in college. I get how it works. The properties are nice. Not once has anyone ever told me "treat the sign bit as a -(2^n) bit." This is a borderline life-changing revelation.

SJohnTrombley
Автор

By far the best explanation of two's complement.

livium
Автор

the way you first worked with flawed methods and then built your way to show us why adding 1 to the one's complement works better was really amazing . thank you so much

hasnaa
Автор

Been fiddling with bits for 20 years and I don't think i've ever seen this explained as clearly as this. The video is a joy to watch, great work!

mariobrito
Автор

A great way to explain not just the process of negative binary numbers but actually why two's complement is used.

razsamy
Автор

Oh my gosh the two's compliment is beautiful and I realized this at 12:18 that -8 makes so much sense

TFGaming
Автор

This is far better explanation than the paid course at my university. Thank you so much.

CastorTroy
Автор

A couple of years ago I had to learn those things for university, and I did, and got a good score, but due to the fact that I'm going to be a SW Developer that programs microcontrollers, I had to re-learn these things and watching this I've realised that I didn't understand the complement method the way I was supposed to. My teacher just told us to add 1 and that's it and now, after 4 years, I have finally understood why. You are awesome. I really hope a lot more students watch your videos.

adrianolariu
Автор

Wow, best explanation ever. You explained it! In school they just say, here is the Two's complement, take it and don't ask why it works.

tomc
Автор

That moment when you find a great channel, but the last upload is 2 months ago. And then the next day 3 videos go up.

indjev
Автор

You are a hero in my book. Amazing how you present these video's, you keep it interesting and the build-up is just right. Keeping it interesting while teaching is important but I always think that making people feel smart while teaching is equally important. In my opinion you nail both.

RetroHoo
Автор

I never understood the need for 2's compliment before this video
Thank you so much

akshanshkmr
Автор

THANK YOU. I have been taught this by 2 instructors at a college. NONE of them simplified this like you did. IT FINALLY CLICKED!!!

nicholasantonini
Автор

I see a lot of people with blown minds in the comments, at the fact that the "sign bit" is actually just a negative-valued bit. I'm *so glad* I was taught it like this in university. It just fit right into my head. It made sense from day one.

PhoenixClank
Автор

Nice, you just said something that made sense.

When I was in computer class in school, we were presented with a lesson on binary and it wasn't explained why these are one's or two's complement, just that is what they were called.

thepvporg
Автор

Another neat property of two's complement is sign extension.
In some architectures you'll often find yourself converting a number between sizes. So for example, we have a 4-bit number we want to resize to an 8-bit number.
1010 = -6
When we extend the sign, what this means is when we convert to a larger number, every added bit copies the value of the most significant bit from the smaller number.
= -6
This also works on positive numbers:
0100 = 4
= 4
The only drawback is ou have to make sure your hardware does not keep trying to sign-extend on an unsigned number.
1000 = 8 (Unsigned)
= 248 (Unsigned)
Fortunately, the same hardware used to drive signed number behavior in twos-complement should be able to also ensure sign extension only kicks in when it's in use.

YaroKasear
Автор

most just teach that 2 step process for getting negetive numbers
but u explained how that 2s complement steps works
thats really genius
you are amazing brother

TechnoSan
Автор

Been searching articles for more than 30 mins and didn't find any good ones and later found this . Easy and clear explaination . Thanks a lot

darshanbilana
Автор

Wish I had found your videos earlier in the semester. You've been better in a few minutes than my professor all semester. Click comment, but very true.

willsi