going out of bounds if you don’t or can’t check for it or if your hardware doesn’t signal it to you can be really really embarrassing because all sorts of dangerous situations can happen perhaps the most easy one to understand is that yes if you add together two positive numbers that are too big they’re going to come out looking like a negative number the the overflow situation will propagate into the sign bit you amp together two things which you’ve got a zero on the Left saying clearly they’re positive when the whole thing overflow is you end up with the answer having a one in the sign bit so it’s looking negative if you for example haven’t had a digital radio altimeter which was absolutely sure that you were at 30,000 feet and then suddenly found that it to run out of bits and oh dear you’ve added together the latest increments in height course you’ve climbed a bit and oh dear you seem to be 60 fathoms deep under the sea things can get very very embarrassing indeed if other hardware that controls your engine or your flaps relies absolutely on this thing being correct I’m going to describe to you in three different ways how you might tackle doing negative numbers whichever notation you use it turns out to be handy to keep the right-hand side of your bit pattern as you look at it the actual magnitude of the number and save the leftmost bit as you’re looking at it for denoting the sign and almost universally it will be if that’s so called sign bit as it’s now called is 0 then it denotes a positive number if it’s a one it’s going to denote a negative number so roughly speaking if you think about that 0 and 1 signaling the sign that leaves you three bits left for the actual size of the number be it positive or negative well in three bits you can hold anything from zero to seven so roughly what one is saying is that if we have a range of numbers that goes from plus 7 2-7 do you think about it that’s 14 do from numbers one to seven positive 1 to 7 negative 14 different numbers but in four bits we can accommodate 16 numbers to the power 4 is 16 naught 2 15 in hand side so where’s the other two gone we’ve allocated for teams to all the other two are real trouble causes because what tends to happen in your naive approach to this which we’ll do in a minute is those two missing numbers converge on wanting to be zero so you end up with plus 0 and minus a 0 and that is a pain you start off with zero four zeros here four plus a 0 if you put a one in the sign bit position but leave the others to zero then of course you’ve got minus zero what could be more nightmarish if you’re trying to design a binary adder circuit to say oh we’re not just got to check for plus zero we gotta check 4-0 okay and all the rest it just follow exactly like that look 00 01 is +1 so what would minus 1 be same as +1 or not one but put a warm to denote negative at the left hand side and that works all the way in the sign and magnitude notation the example I’m going to take in all three of these notations i’ll be covering is just simply this plus 7 and add on minus 3 to it in other words it’s seven take away three the answers gots before now where do we get to its sign and magnitude we write down plus seven then we write down 10 11 don’t forget this is now the sign bit it’s special the note 11 2 and the 1 is 3 but the one in the sign bit position says I’m trying to do 7-3 your hardware man then start saying look I’ve got to build some binary logic circuitry to do this and what I want is just to do simple binary editions with carys even those a subtraction I don’t care you’ve told me you denoted a negative number I want to do simple binary editions of ones and laws and I want the answer to drop out just magically to plus 4 will it not a chance I’m going to say if you just add them what would happen you get 1 plus 1 is 0 and carry one one and one and one we now know you put down a one and you carry a 1 1 plus 1 is 0 but it carries a bit over into this sign bit column oh what a nightmare what is trying to tell you look is that the answers to it isn’t when you come to analyze this carefully it happens largely because the sign bit is not actually part of the number it’s an add on extra so this one way I think we can throw right out the window and say it may appeal to you as a human to do it like this but really that is not going to be easy to build hardware around what you want actually in some sense is to map those negative numbers differently in other words you map them top down from the big numbers down to the little ones in terms of what an unsigned the law would be doing the other way around and it all is so much easier what ones complement does is it says form the negative number by taking a positive one and inverting every bit if it’s a zero turn it to a one if it’s a one turn it to a zero what that does is it turns 0 into being what would have been 15 in unsigned yeah but ah since one on the left is signed and now image is a negative number you still have the two representations of zero problem you’ve got zero and you’ve got minus zero however look what happens here you map 0001 you flip all the bits this is a rule to make it negative change 0001 into being 1110 so that is how you do minus one but what does 1110 mean if it were an unsigned number it means a plus 4 plus 2 is 14 so I’ve mapped minus 1 into being 14 I’m at minus 2 into being 13 this is what i mean by coming downwards okay now if you do that well you’re part way on the way to getting a system in which the sign bit behaves almost normally and that’s what you want to do let us know let me say yet again this still has the problem of two representations of 0 which hardware and software people would absolutely hate could you imagine in your java program if you wrote if i equals equals 0 behind the scenes a swearing compiler indulges in lots of bad language saying owing to the architecture of this machine now now got to check for plus 0 and minus zero don’t want that you want one representation of 0 anyway for the moment this is a step on the way we’re getting there this is one’s complement and let’s do our thing of taking plus seven and adding minus three well since seven is a positive number that is still 0 1 1 1 but we’ve now got to add in minus 3 well we look up what minus 3 is in one’s complement and it is 1100 now what I’m saying is that is a positive representation because it’s got not there as plus 7 this is a negative number clearly it is it’s got one in the sign bit position let’s just add them together one and 0 is 1 1 and 0 is 1 1 and 1 is 0 but carry 11 and 1 is 0 this is in the sign bit position now but we’re still treating it now like it’s an ordinary binary pair of integers but I’ve still got 1 plus 1 is 0 and it will generate a caring the rule in one’s complement arithmetic says the following treat the sign bit just like a normal binary addition in that position but if you generate a carry out from the sign bit don’t throw it away don’t ignore it just bring it back on a journey around to the right hand end of the number and add it in so we then have naught naught 1 1 plus 1 1 + 1 is 0 carry 1 1 0 1 is 0 carry 1 1 and 0 is 1 0 and 00 you p that’s possible that’s the right answer now you might say oh well bringing around that carry bit it’s just black magic yeah that would need a more advanced tutorial explaining exactly why but it really does work is simply this it says just treat the sign bit as normal don’t get panicked about it if you do generate the carry bit just bring it around to the right hand then and add it back in ok so we’re making real progress now we’ve got something which does give us a right answer but you have to mess about with carry bits a little bit wouldn’t it be nice if we could get rid of that effect don’t have to worry about any carry bit and also also what we really want to solve is this we dumped 12 zeros ok now there is a big problem here because if you think about it you’ve got some positive numbers seven negative numbers you’ve got two left over if you don’t have to zeros and you’ll know what 10 what’s going to happen to that 16th number as we’ll find out now in the final phase of this story your leftover number has either got to become an extra positive number or an astronaut Eve number so will now do two’s complement two’s complement is equivalent to the ones complement with one added to it let’s just take a sample middle of the range number plus 3 let’s turn it into twos complement and remember what you do to do that is you take the binary representation of three you first of all turn it into one’s complement by flipping the bits and then you add one let us take plus 3 this is zero zero one one and we want minus 3 in well first of all we do minus 3 in one’s complement easy you just flip the bits you go 1100 and in two’s complement what do you do you take the ones complement which you’ve already got a new add one and you see what happens one plus zero is 10 11 there’s your answer so minus 3 in two’s complement is represented by 1101 in unsigned terms this has now been represented by 13 1101 whereas in one’s complement terms it was 1100 it was represented by 12 so we’ve shoved at the whole range down by one believe it or not that now magically gets rid of the two zeros problem just by shifting the range and if you like this is the fundamental piece of magic which I think we can do over here just consider 0 0 0 0 plus 0 I’m now going to turn it into minus 0 and with trepidation because it’s probably going to be some other completely different bit problem but just look what the rule says it says do the ones complement first of all 11 11 and add one because two’s complement is one’s coming up this one what happens now 1 1 is 0 carry 1 1 0 1 is 0 carry a 1 1 0 1 is 0 carry 11 and what we’re in the side bit position but we don’t panic it’s just like any other one on one is 0 and we carry one I’m going to do an end-around carry no thing you have to remember in two’s complement is that carries at the left-hand end I just thrown away and ignore they do not do an end-around carry why they did in one’s complement this magic you just throw the carry bit away and what you’re left with no not-not-not look at plus zero has mapped into looking like plus zero when you take it two’s complement negative that’s exactly what you are after is one representation of zero and only one but you’ll now say are now come on you warned us that if you have only 10 and you if you have and one to seven that’s seven numbers and minus 1 by seven oh seven times you want 10 that’s only 15 slots taken up what’s happening to the 16th slot although it’s a four bit system it now ranges from 0 to 7 in positive but in negative numbers there’s the zero appearing again but right out the bottom one and three zeros what does that one represent that and the answer is minus eight what happens when he goes wrong well it we’ve discovered of course that in two’s complement for bit representation we can go from minus eight up to plus seven you add anything within those ranges as we’ve been doing like seven plus minus three there’s no problem the answer is going to be in range obviously but if you add together shall we say plus 72 plus seven and that’s plus 14 and that’s too big positive to be held in four bits equally if you had I don’t know minus five 2-5 comes to minus 10 and we can go down as far as minus eight but not minus 10 so how does this show up then we clearly going to get overflows well I think the answer is if you look back or think back in the video to what we were doing when we were carefully adding 7 2-3 and staying in range what I didn’t point out but should have done at the time is that the carry bit that appeared on the left you remember you carried out of the sign position I said oh it’s two’s company cuz throw it away yes you can throw it away but what you would find is if it’s gone wrong is that there was a carry in to the sign bit before there was a carry out and the rule very simply is this is if they carry in to the sign bit and the carry out to the sign bit are the same sort of thing like you carrying a worn you carry out a one that’s fine or you carry in an or you carry out or not that’s fine but if they’re the opposite way around a naught gets carried into the side bit of one gets carried out or a one gets carried in & anor gets carried out surefire sign of overflow and that is exactly what the hardware engineer wants they don’t want to have to start thinking about the magnitude of the numbers they want a simple rule about carry bits which says it overflowed and then you set a hardware overflow indicator just like that this is a problem it hitters and they would have embarrassed us slightly in the Ackermann function video because the those counters we were setting for all the big integers we were overflowing all the time we just weren’t checking for it


Federico Guzmán · July 25, 2015 at 2:28 pm

Prof. Brailsford is amazing, thanks for the video!

[email protected] · July 26, 2015 at 8:54 am

JUST WATCH THE VIDEO AND SEE………..https://youtu.be/-wnkYX8UQ5g

ScoopexUs · July 31, 2015 at 11:50 pm

Learning about how computers store numbers is very good 🙂 Just wanted to say it was a bit misleading to bring up undetectable "Not a Number" cases and then describe what is really the carry bit present in all CPUs since the 1970s. I.e. detectable and used a lot in all kinds of software 🙂

I think one important notion is to not get too used to 0 being positive just because it's stored as such in a computer. Oh, you can use it that way eminently in computers and it will turn out right. It's just that it could make you blush for math work. 0 is signless and has no unit. Moving on… have fun coding 🙂

amihart · August 8, 2015 at 7:08 am

I don't get why we sign bytes in the first place. What is stopping you from building a machine with no negative numbers? And once you do, can't you just implement negative numbers using software?

Teo St · August 9, 2015 at 10:44 am

Could someone tell me what would be the most significant bit of the number 1 0100 if the first bit shows the sign ? Thank you!

Neil Roy · September 20, 2015 at 7:50 pm

Thanks for this. I had a vague understanding of this, but I was never quite clear on it. This really cleared this up for me.

Abdelrahman Gamal · October 6, 2015 at 10:28 pm

Why's nobody explain why the math comes out right ?! It's because when you flip the bits and add one, you're actually adding 10000.. which has an additional digit more than the original numbers. It's like A-B = A+(C-B) ignoring the additional digit of the result which comes out to be C itself!

Ken White · October 12, 2015 at 4:20 am

Oppa Gangnam Style? Didn't youtube have to update their software because of this?

Alexander Bollbach · October 26, 2015 at 7:52 pm

this was a 'bit' confusing. i'll re-watch it, that should help.

Noel Goetowski · December 8, 2015 at 8:23 pm

What happened to Dr. B's finger?

Noel Goetowski · December 8, 2015 at 8:27 pm

9:43 Did anyone else immediately think of the Beach Boys right here?

Daniel Hale · December 9, 2015 at 10:07 pm

Watching these videos makes me absurdly giddy. I love learning (and re-learning, in case I've forgotten since college) how this stuff all works at the lowest levels. I wish I had more time to watch them throughout the day, but compiling breaks don't take as long as they used to. 😀

T33K3SS3LCH3N · December 28, 2015 at 4:35 pm

Easiest method of reading negative numbers in two's complement:
Seperate the leftmost digit from the rest, for example 1011 becomes 1000 (= 8) and 0011 (= 3). Take the negative of the left number and add it to the rest – in this case you get -8+5 = -3.

To understand how two's complement really works, Imagine the four-bit binary numbers as a circle. You start with 0000 at 12 o'clock, 1000 is at 6 o'clock, and the last number before you complete the circle and go back to 0 (between 11 and 12 o'clock) is 1111.
In unsigned binary this is where the overflow happens: 1111+1 (= 15+1) should be 10000 (= 16), but because you don't have that fifth bit you get 0 (0000) instead.

Now, this is how you read the same circle in two's complement: At 12 o'clock you have 0000 (= 0). To the right you increase the numbers (0001 = 1, 0010 = 2, 0011 = 3, …). This works until you arrive just short before 6 o'clock, where you have 0111 (=7), which is the highest positive number. So far the two's complement circle is just like it would be for unsigned binary.

But as we arrive at 6 o'clock where 1000 stands, we have a problem, because 1000 now is -8.
So as we add 0111 (=7) and 1, we get -8 instead of +8. This is where two's complement has its overflow.

Instead now go back to the 0000 and this time go down the circle to the left side: The first number you see there is 1111, and that is -1. Then you have 1110, and that is -2. So by going from the top down the left side, you count down from 0, until you arrive at 12 o'clock again to find 1000 = -8.

Harry Tsang · January 2, 2016 at 7:38 pm

so the 2038 problem can't be solve but replace with 64 bit

Billy Heng · January 27, 2016 at 6:31 am

Good lesson on binary flaw thanks how about address mode is there any issue and I notice there are problem in Unicode as well if you could have a lesson on those and is there any history on it. Happy to know thankyou very much.

Billy Heng · January 27, 2016 at 6:34 am

may be international timezone problem on 2000yrs bug issue usage of timestamp international worldwide on atomic clock spectrum timing and international human language in different continent. No, this world is full of problem and bugs all around PC.

Allan Richardson · January 29, 2016 at 5:55 pm

In the pre-360 world, the IBM 700/7000 series used sign and magnitude for their 36-bit binary integer arithmetic, adding the extra hardware to account for signs and overflows properly. Some programming languages, such as FORTRAN, used -0 to represent a word to which no value has yet been assigned; their compiled instructions tested for -0 before performing an operation, and knew that a programming error had occurred (using an uninitialized variable) if -0 was found. No arithmetic operation would ever GENERATE a -0 result; it could only appear as a result of copying a constant into it, or compiling an object program with that value (octal 400000000000, or in the hex notation devised later for the 360 series, 800000000) loaded into all variables with no initial value specified by the programmer.

Strangely, although integer math in the later 360 (introduced in 1965) used twos complement notation, FLOATING point math used sign-plus-true magnitude for the mantissa (significant digits) and an excess-64 notation of powers of 16 for the exponent (order of magnitude): in a 32-big (single precision) floating point number, the first bit was the sign (1 for negative) of the entire number, the next 7 bits represented the power of 16 plus 64 (0000000 meant 16^(-64), 1000000 meant 16^0, and 1111111 meant 16^63), and the remaining 24 bits represented a binary fraction. Double precision (64 bits) and extended precision (128 bits) kept the sign and magnitude the same and added the extra 32 (thus a total of 56) or 96 (for a total of 120) bits to the mantissa.

I suspect the reasons were that (a) floating point required more complex logic anyway, so temporarily generating twos complement for addition and subtraction were not much extra effort, (b) adding precision only required appending zero bits to the right, not the current value of the sign bit, and (c) more multiplying and dividing than adding and subtracting are done in the areas where floating point is commonly used, and those operations ignore the signs until the end, then determine the sign of the result from the signs of the operands.

Narin Pornwatcharakul · February 1, 2016 at 1:57 pm

1' มั่วมาหนี่น่า

Narin Pornwatcharakul · February 1, 2016 at 2:00 pm

1's ,2's มั่วมา แล้วตรงนี่หน่า

Alexandr Sevrjukov · February 14, 2016 at 8:30 am

I wish these videos were around back in the days when I was at college….

squirrel brains · April 23, 2016 at 3:25 pm

very good video. the small printout is rather out of focus most of the time though, while the handwritten is much clearer.

Mark Sze Chai Chan · April 25, 2016 at 12:41 am


snetsjs · May 10, 2016 at 7:07 pm

Excuse me if this is an ignorant question. Why not use a bit from a different memory address to hold the sign? It seems you could use (with 8 bit bytes) a single byte to hold the sign bit for 8 different numbers. My guess is the difference in resource usage and computing time makes this inefficient but I'm just curious about your explanation.

Amanda Dean · May 14, 2016 at 8:45 am


Grombo79 · June 11, 2016 at 4:26 pm

beautiful video

Anton Nym · September 12, 2016 at 4:00 am

This is beyond brilliant. Makes it so much easier when designing little ripple adders and such for ALUs! I especially appreciated the discussion of the rule for overflow. That would have taken me a while to work out. Wonderfully explained. Thank you!

TallWaters · September 24, 2016 at 3:30 pm

I want to know the black magic reason why adding one makes it all work out?

PacketCyclotron · October 27, 2016 at 7:53 pm

I really like Prof Brailsford.

PNWMan · October 31, 2016 at 2:15 am

I thought I was an "expert" on this kind of stuff, until I learned about the overflow rule at the end. This kinda gets me excited again about circuitry; very well explained 😀

vishal kole · January 6, 2017 at 12:38 am


Lingyong Wang · January 23, 2017 at 4:35 am

this is great!

Rex Galilae · February 27, 2017 at 2:45 pm

This man's charm distracts me from paying attention to what he says 😅

ferna2294 · March 6, 2017 at 7:48 am

I want my alarm clock to wake me up by the sound of 9:08

BTW for some reason I felt a big relief after he explained how to get rid of that negative zero.

Andrew White · March 6, 2017 at 9:07 pm

This was useful when computer ALU s could only add. Now the smallest of microcontroller can subtract in hardware. Most can multiply.
If it's large numbers that need manipulation, that's what C compilers do best.

leivadaros · May 25, 2017 at 10:58 pm

11:20 Almost overflowed there :p

Cooper Gates · June 5, 2017 at 11:13 pm

Ones' complement: "We have to check for +0 and -0"

No you don't. Just test if all the bits are the same. The XOR across the board would be 0.

Mister Voldemort · June 8, 2017 at 10:46 am

A level students here?

JamesBeanMachine · June 12, 2017 at 11:04 pm

My favourite thing ever is when integer overflow happens in a video game, and 2 billion points of healing becomes 2 billion points of damage, or vice versa.

Beep Doop · June 17, 2017 at 8:21 pm

its kind of obvious
we know through ordinary binary addition that:
1111+0001=_0000 =>

0-1 = -1 = 15

all there is to it is that 0 and 16 is the same number
so 5 is both 0+5 and 16-11

-11=5 and -5=11

Carl T. · June 22, 2017 at 9:43 pm

Why have negative numbers in the first place?

Mohammed Boukhlouf · July 16, 2017 at 9:25 pm

Would it be possible to have English subtitles or auto generated subtitles?

lisamariefan · July 31, 2017 at 6:43 am

The "getting rid of the two zeroes" problem is getting into modular mathematics territory…

ProCactus · August 12, 2017 at 1:21 pm

Where does 'two' come into it ?

Dan J · August 18, 2017 at 10:45 am

I like how happy he got when +0 and -0 mapped to the same binary representation. It's almost like he won the lottery.

BATTLEMODE · October 16, 2017 at 10:07 pm

Great lecture, thank you!

Omar · October 22, 2017 at 3:10 pm

I like how he pictures the computer hardware having human emotions

Chibuike Abana · October 30, 2017 at 3:29 pm

i am working on a project that involves integer security. i noticed there is high chances of integer overflow which could be a serious issue. sharer insights with me please, on how this could lead to integer overflow

Megadardery · November 7, 2017 at 5:24 pm

The hardware overflow indication was brilliant.

bruh moment · November 10, 2017 at 10:14 pm

Wouldn't the altimeter go from 32767 to -32768?
A 16 bit signed integer is the smallest number of bits you can use with a sign and still get up to 30000, and it's got a maximum value of 32767
Not claiming the video is wrong, or even that it really matters, but I'm curious if you guys know something that I don't.

galier2 · November 19, 2017 at 10:08 am

Funny his example with the plane at the beginning as something similar happenned to the Mars Lander when it crashed. It thought it was several hundreds meter below surface and dropped its chute because of that, unfortunately it was still thousand of meter above surface.

galier2 · November 19, 2017 at 11:22 am

After reading some comments here, I have to rant here a little bit:

It's complEment with an E not compliment. A compliment is when someone says something nice about you. So I don't compliment you for your spelling :-).

Mr.Tweezy007 · November 30, 2017 at 11:44 am

These videos don't realy help tbh. The constant zooming in and out and focuss going off is silly and disorienting. I couldn't tell if this was supposed to be some sort of tutorial or an interview. Weak content.

Billy Heng · January 8, 2018 at 7:36 am

Why ? old computer power supply and slot has negative -5v & -12v not being use. Reverse bias idiode fundamental was not design for negative usage can that be done ????

madnc · January 14, 2018 at 6:57 pm

Anyone know how to represent -32 in 2's complement using 6 bits?

Mark Jacobs · January 15, 2018 at 5:06 pm

FINALLY!!! I now understand what overflow means. Thank you!!!

Eric von Wald · January 17, 2018 at 2:59 am

I would like to "compliment" you on an excellent presentation

jaime sterling · January 18, 2018 at 1:50 pm

this was bare confusing still ngl

viraltaco · January 27, 2018 at 10:11 pm

I'm glad someone solved this before I came around. Thank you mysterious person!

dasten123 · February 25, 2018 at 10:03 pm

I found it a bit hard to follow. Had to watch the beginning and the ending twice

Hrnek Bezucha · March 27, 2018 at 8:44 am

The ending was a bit confusing but what happens is that you have two bits somewhere in a register that signifies flags. Sign for positive or negative and overflow for out-of-range. These flags are set in hardware automagically whenever the count moves over a specific number in one way or the other.
In Arm the place it happens is xPSR – program status register.

Nick Enchev · April 23, 2018 at 5:53 pm

Love your videos!

Mishkafofer · April 29, 2018 at 6:10 pm

love camera work, live action.

Rev. Dave Moorman · May 2, 2018 at 9:15 pm

The famous 6502 doesn't do anything except addition. If you SBC (subtract with carry), you must Set the Carry before the action. The chip (evidently) does a EOR 255 on the subtrahend. You set the Carry, which is the +1 of 2's Compliment. Brilliant!

em em · May 3, 2018 at 10:06 pm

thank you sir!

Cigmorfil · May 7, 2018 at 11:12 am

There was an overflow bug in Micropose's Railroad Tycoon – if you bought more than 50% of the shares in your company (so you couldn't be thrown out) and then ran the railway in the most inefficient, loss making way possible, your cash would decrease through the negatives (overdrawn balance) until it overflowed and you ended up with the largest amount of positive cash; IIRC making money at this stage did not overflow back negative

Dark Thoughts but things are looking up · May 13, 2018 at 9:22 pm

In the PDP8 the instruction that did this was a bit sinister. It was known as Compliment and Increment the Accumulator CIA 😩

pcuser80 · May 18, 2018 at 6:11 pm

Does January 19, 2038 03:14:08 GMT rings a bell?

crayzk · May 21, 2018 at 9:39 pm

9:08 Yipee! Great video!

Mic k · May 28, 2018 at 10:47 pm

Ohhh reminds me of collage

vargonian · May 30, 2018 at 3:33 am

I don't understand how you could ever "carry a 0" out of the adder. Carrying a 1 makes sense, but you don't carry 0's… right?

MaggieRoara · July 25, 2018 at 11:13 am

Professor Brailsford, you splendid man! Thank you thank you thank you. Now I wish he explained how these get turned into hardware.

Jerry Kilpatrick · August 23, 2018 at 9:29 pm

I love this guy… I could watch his videos all day long.

jagardina · September 1, 2018 at 2:14 am

The devil is in the details. I really am impressed with how much thought has been put into computer science.

Julio Talavera · September 15, 2018 at 5:22 am

🙌🏻 🙌🏻 🙌🏻

praveen padala · September 20, 2018 at 1:04 am

how 1000 equals to -8 in twos complement when it is -0 in ones complement?

praveen padala · September 21, 2018 at 4:41 am

can you suggest textbook to study the two's complement in detail

Joel Dorrington · September 26, 2018 at 6:09 pm

Love this guy, he's cool and he loves what he does!

Robert Saler · October 4, 2018 at 7:16 pm

Head explodes . . .

Balram Pillai · October 5, 2018 at 6:39 am

@9:10 Yipee. That was the best explanation to one's and two's ever

Stephen Liseo · October 11, 2018 at 3:40 am

You Sir are a gentleman and a scholar, great video

The Oracle of Awesomeness · November 9, 2018 at 5:42 pm

1:38 Positive and negative represented in binary,

Steve Alino · November 23, 2018 at 6:25 pm

So how is the sign number written in binary so the computer can tell it's a sign number and not an actual number please? For example how do you tell the difference between 10101001 meaning 169 or minus 41?

Sal Morreale · December 3, 2018 at 2:31 pm

I want to learn computer science from Professor Brailsford.

Gold Winger · December 20, 2018 at 7:53 pm

One of the machines I worked on as a young man frequently gave us negative zeros. So you couldn't use IF X.EQ.0 with any degree of confidence. I'm not sure which machine it was, it could have been the CDC 6400 or the CDC 7600.

Man Afro · December 21, 2018 at 8:56 pm

why is this guy making such weird faces all the time? it looks like he's in pain.

Jm56Z · March 13, 2019 at 9:46 am

An overflow is what happened to the first Ariane V rocket. It was driven by the same code as Ariane IV, but its acceleration was so great it overflowed, leading to the most sharp turn ever tried by a rocket.

Tyler Barnes · April 10, 2019 at 4:31 am

More down at the metal content like this !!!! <3

sankalp jugral · April 14, 2019 at 3:33 pm


GH1618 · April 22, 2019 at 4:21 pm

About a third of my computer career was spent working with one’s complement machines. They worked well. The extra zero was not a big deal. The hardware took care of it.

Bhavuk Garg · April 26, 2019 at 6:24 am

Clear explanation, Finally I am clear about 2's complement. Thank you sir. I wish I have a teacher like you.

Steve Jones · May 6, 2019 at 10:10 am

I don't like thinking of a negative number in 2s complement just being a 's complement then adding one. To me, it's much more elegant to think of it as winding back from zero. That is, subtracting the number from zero, which to a human being at least, is just as easy as that adding 1 trick, but much more intuitive. However, the addition trick is no doubt easier in hardware, but from a human intuition point of view, the winding back of a the odometer from 0 provides a much more intuitive and, I think, accurate model.

The issue of detecting overflows (alluded to at the start and mentioned at the end) needs a whole area on its own. One of my big issues with implementation of C (and, maybe, other languages) is all those silent overflows that happen. Not just on a simple case of adding two positive integers and getting a negative without and exception, but the horrible things that happen with expressions combining different integer representations, both by length and whether signed or not. Silent overflows can happen when, unbeknown to the programmer, expressions are calculated within the expression using the "wrong" type of integer (signed or by length) for the output.

I once ported a C programme written and tested on a 32 bit machine, and it failed catastrophically on a 16 bit environment. That wasn't because care hadn't been taken to use longs and ints appropriately for the output, but because an int had been used within and expression and the the compiler produced code that worked with "int" precision, even though all other variables, including the output was long. No problem on the 16 bit environment, but it blew up on the 8 bit, but silently with no exceptions and splattered all over memory wiping out all the evidence of where it had gone wrong.

Jeremy Firth · June 11, 2019 at 1:34 pm

Nice camera/focus work on the close-ups on the paper. That was seamless and some high-end professional work.

Custard Tart · August 29, 2019 at 11:52 am

Dreadful camerawork distracting from the great message. Random zooming, annoyingly narrow depth of field when looking at anything apart from the presenter. Shame.

Michael Carr · September 27, 2019 at 6:09 pm

There's a Tower of Hanoi in the background. 👍👍👍

Jannis Adamek · October 11, 2019 at 1:35 pm

I love this video! the professor's explanation skills are extraordinary!

チュimoc · October 21, 2019 at 1:38 pm

11111111 is -1

usuallydead · November 21, 2019 at 4:36 am

I feel like I just listened to Winnie the Pooh speak to me in binary for 16 mins.

Efe U · November 23, 2019 at 6:48 am

Thanks for the complete explanation.

RyuDarragh · December 24, 2019 at 7:33 pm

I design CPU hardware and did my ALU to treat "-0" as an indicator of an overflow. The O flag. The carry is still set, but the ALU outputs the O flag and promotes the high order bit for the S flag only if the O flag was not set, It functions as described in the video, but works regardless of the width, 8, 16 and 32 bits.

Udai Kumar · January 14, 2020 at 1:20 pm

Thanks professor for explaining the complements. I always wondered why we did like that . ☺️☺️☺️. As Elon Musk says , we should firstly tell the kids what is the actual purpose of a method itself before telling the method. Our brain recognizes that as important if we know it's actual use on real life.

Leave a Reply

Your email address will not be published. Required fields are marked *