IGCSE Computer Science 2023-25 - (1) Data Representation - Number Systems 1.1(c) 2's Complement — Transcript
Full transcript
- 0:00okay welcome back everybody and we're
- 0:02going to be looking at the um the third
- 0:04and final part of 1.1 number systems
- 0:08following the new computer science igcse
- 0:11syllabus
- 0:12um in this we're going to be looking at
- 0:15how to add
- 0:16two positive eight bit numbers
- 0:18we're going to be looking at overflow
- 0:20when we and and how this is caused when
- 0:22we do add to positive 8-bit binary
- 0:25numbers we're going to look at logical
- 0:27shifts
- 0:28on positive
- 0:31binary numbers and how we can multiply
- 0:34binary numbers and divide binary numbers
- 0:36using this method
- 0:38we're then going to finish off with um
- 0:40something called two's complement to
- 0:42complement notation and this is new
- 0:44um to the to the new syllabus but this
- 0:47this allows us to represent both
- 0:49positive and negative
- 0:51binary numbers
- 0:53once we've done that we should be moving
- 0:54on sticking with the um data
- 0:56representation but we'll be moving on to
- 0:58text sound and images
- 1:02okay
- 1:03so
- 1:04adding binary numbers together
- 1:06well in the normal system in an idenary
- 1:09system would be
- 1:10adding we'll be looking at the units
- 1:12column first of all and if we have one
- 1:15plus two obviously that equals three
- 1:18it's only when we carry over and we
- 1:19maybe add nine plus four and we get four
- 1:22lots of units and one lot of ten that we
- 1:25can sort of draw on that and see
- 1:27similarities
- 1:28in the
- 1:29in the danery system
- 1:31so there are some rules
- 1:34and here we go we've got four rules
- 1:36um if we have zero plus zero obviously
- 1:39that's going to be a zero it's the same
- 1:40in any number system
- 1:42um one plus zero of course is still one
- 1:46but when we get to the next two one plus
- 1:48one would equal two
- 1:50which in binary would be one lot of two
- 1:52and no lots of ones
- 1:54and then if we have one plus one plus
- 1:56one obviously this is three but three is
- 1:59represented as um one lot of two and one
- 2:02lot of one
- 2:04so if we follow this method
- 2:07we can look at this sum we've we've got
- 2:08here this um
- 2:10eight bits
- 2:11um
- 2:13from two registers
- 2:15and register one and i've put register
- 2:16two underneath it as a simple sort of
- 2:18addition sum
- 2:20we can go step by step through this
- 2:22together
- 2:24so we have one plus zero obviously
- 2:26equals one
- 2:28now we get to the third rule
- 2:30one plus one
- 2:31is
- 2:32two
- 2:33but that would be
- 2:35no units no ones
- 2:38so we carry over the two
- 2:40so one plus one again we're going to do
- 2:42the same thing zero
- 2:44carry the one
- 2:45here we've only got one so we pop that
- 2:48into the um into into the answer
- 2:50one plus one again
- 2:52zero carry the one
- 2:54one plus one again
- 2:56zero carry the one and now we've got the
- 2:58final rule one plus one plus one
- 3:01obviously equals three so that's one lot
- 3:04of one
- 3:05and one lot of two that we carry over
- 3:07and we can put this into the final
- 3:09column to get the answer
- 3:11one one zero zero one zero zero one
- 3:16hopefully look at that you could you can
- 3:18remember how you might change this first
- 3:20of all into a idenary number how we
- 3:23could convert that and also if we would
- 3:26divide it in half
- 3:27i'm splitting into two nibbles how we
- 3:29might change this into an hexadecimal
- 3:33now if we were to change the first
- 3:36number
- 3:37the the first term the first digit
- 3:39in that first byte of information and
- 3:41change it to a one
- 3:43obviously when we add all these numbers
- 3:45together again we'd end up with
- 3:47something
- 3:48with a ninth bit something that's called
- 3:51an overflow
- 3:52um this obviously would lead to errors
- 3:55in the sense that we can't have
- 3:57nine digits nine numbers represented in
- 4:00an eight bit number system so we'd end
- 4:02up with problems there and the system
- 4:04might
- 4:05might crash or it might ignore
- 4:08that extra digit so you wouldn't get the
- 4:09correct answer
- 4:12i would then move on
- 4:14so logical binary shifts 1.1.5
- 4:20okay we're going to use this technique
- 4:23to shift numbers um left and right
- 4:26backwards and forwards in a register
- 4:30um
- 4:31obviously with binary numbers things
- 4:33need to be added together taken away
- 4:35removed
- 4:36but in this case we're going to be
- 4:38multiplying
- 4:39or dividing um bytes in this case of
- 4:43information
- 4:46so
- 4:48if we were to shift
- 4:50the numbers in this system i'll shift
- 4:53these ones and zeros across to the left
- 4:56we would be multiplying you'll see that
- 4:58in a moment and if we shift them to the
- 5:00right going down the radius so to speak
- 5:03then we will be dividing by two what
- 5:06does that mean
- 5:07we have a an eight bit register here
- 5:10below and it contains the daenery number
- 5:1221 you can see that it's one lot of 16
- 5:16one lot of four and one lot of one added
- 5:18together obviously 21.
- 5:21now if we shift these digits to the left
- 5:26if we move them
- 5:28one space
- 5:30okay
- 5:31um we're going to get one lot of 32
- 5:33one out of eight and one left two now
- 5:35that's obviously 42
- 5:38which would be twice
- 5:41the value of 21. so 21 times 2
- 5:44equals 42.
- 5:46when we're shifting we've got spaces we
- 5:48automatically put in a 0 into the end
- 5:51column now you mind some of you might
- 5:54see this and think
- 5:55ah this could cause problems and it does
- 5:58cause problems
- 5:59so as a bit shift an empty position
- 6:03is replaced with a zero and obviously
- 6:06there are limits in an 8-bit number
- 6:07system as to how many zeros you can put
- 6:09in before it completely zeros out
- 6:13so for example if i was to take this
- 6:15number here
- 6:16um one lot of 64 one of 32 and one love
- 6:1916 and i was to move this
- 6:23five places to the left
- 6:28then we would end up with um a register
- 6:30full of zeros okay but we've multiplied
- 6:33this number
- 6:34um and obviously when we multiply this
- 6:36number the equivalent of
- 6:38the value 1 1 2 or 112
- 6:41we're not when we times it by 2 and 2
- 6:44and 2 and 2 and 2 again
- 6:47we're not going to get
- 6:48purely zeros
- 6:51okay
- 6:52so here's some more examples
- 6:54um
- 6:56what we're going to do first of all
- 6:57write 24 into the 8-bit register well
- 7:00that's obviously um one lot of 16 and
- 7:03one lot of eight
- 7:05okay so that's that's straightforward we
- 7:07know that
- 7:08now we're going to shift to a logical
- 7:10shift going three places to the left
- 7:13so we're going up the register
- 7:16so
- 7:17shifting them one two three
- 7:20as you can see there is some
- 7:22times two
- 7:23times two times two
- 7:26which would equal
- 7:27192. so we've times it to um 24 times 2
- 7:32to the 3 which represents the three
- 7:34shifts
- 7:35okay 192.
- 7:37now if we go back to the existing
- 7:39um results the existing register which
- 7:41is 24 and we go
- 7:44two places to the right
- 7:47you can see there we've gone one two
- 7:49we're basically dividing so 24 divided
- 7:52by two to the two two shifts would equal
- 7:55six
- 7:56basically 24
- 7:58divided by 2 is 12 and divided by 2
- 8:01again would be 6.
- 8:04okay so that's how we multiply
- 8:06and divide using logical binary shifts
- 8:13okay and for the final bit we're going
- 8:14to be looking at two's complement
- 8:17on binary numbers how to represent
- 8:19negative integers
- 8:21um when we're using two's complement
- 8:24so in this section again like the others
- 8:25we're going to assume
- 8:27um the eight bit registers are being
- 8:29used for the
- 8:30in terms of the questions
- 8:33the only major difference
- 8:35that we're gonna we're gonna use in
- 8:37terms of these registers is we're going
- 8:39to change the heading of one of the
- 8:41numbers that being
- 8:43minus one to eight one two eight becomes
- 8:46minus one to eight
- 8:48of course that means that we no longer
- 8:49have
- 8:51255
- 8:53different character representations
- 8:56different sequences of ones and zeroes
- 8:58because we've got the minus one to eight
- 9:01this refers to
- 9:03everything
- 9:04which has a one under
- 9:06minus one to eight
- 9:08is a negative number
- 9:10everything with a zero under the minus
- 9:12one to eight
- 9:13is a positive number so we basically
- 9:15split
- 9:17two five five
- 9:18into two into two halves
- 9:21the positives being 0 up to 1 127
- 9:25and the negatives being minus 128 all
- 9:29the way up to minus 1.
- 9:33and here we can see that minus 128 would
- 9:36be one lot of minus 128 and nothing in
- 9:40the other
- 9:41columns
- 9:42whereas plus 127
- 9:44the sort of biggest positive number we
- 9:46can have would be no loss of 128
- 9:50and all the rest of the um the columns
- 9:53being filled in with ones
- 9:57it is important to realize when applying
- 9:59two's complement to a binary number that
- 10:02the leftmost bit always determines the
- 10:04sign of the binary number as i've just
- 10:07said a one value in the leftmost bit
- 10:09indicates a negative number and a zero
- 10:11value in the left most bit indicates a
- 10:14positive number i can't emphasize this
- 10:16enough i'm going to try and show you a
- 10:18number here
- 10:19um a representation of 51.
- 10:22and of course if we look at this you
- 10:24look and see okay we've got one lot of
- 10:2532 one lot of 16
- 10:28a two and a one
- 10:30it's exactly the same as how you would
- 10:32normally do it there are no
- 10:34negative 128s there are no positive 128s
- 10:37in the same way there's no 64s
- 10:40um it is exactly the same
- 10:43so if we want to represent the number
- 10:45minus 49
- 10:48we're going to put a 1 under the minus
- 10:49128 this shows that it's a minus number
- 10:52and we're going to start with that
- 10:54number minus 128. we're then going to
- 10:56add to it
- 10:58positive 64.
- 11:00positive 64 plus minus 128 would give us
- 11:04minus 64.
- 11:06if we then add positive 8
- 11:08to minus 64
- 11:10we would get minus 56
- 11:12at positive 4 we would get minus 52
- 11:15add positive 2 would get minus 50 and
- 11:18finally add positive 1
- 11:20and we would get minus 49 and this is
- 11:24how we rep how we represent
- 11:26the minus numbers we're adding the
- 11:29positive numbers
- 11:30the ones in greens you can see here to
- 11:32the minus 128.
- 11:37well that's it that's how you would do
- 11:41the two's complement representation of
- 11:42negative numbers
- 11:45so
- 11:46have a practice
- 11:47good luck with that and remember if
- 11:49there's a one there
- 11:51it's a minus number and if there's a
- 11:53zero it is a positive number but the
- 11:56question will always say
- 11:58this
- 11:59is a representation of a two's
- 12:01complement binary number
- 12:04that's it for now
- 12:05thank you very much indeed um that as i
- 12:08said at the beginning is the end
- 12:11of this little bit 1.1
- 12:15so thank you very much for watching
- 12:17next time the next video will be 1.2
- 12:20text sound and images
- 12:22if you haven't already please subscribe
- 12:24i will be doing these as quickly as
- 12:26possible i'm trying for
- 12:28one video a week but
- 12:30um bear with me
- 12:32so um thank you very much indeed and i
- 12:34will see you next time
- 12:36bye for now
About this transcript
This page contains the full transcript of IGCSE Computer Science 2023-25 - (1) Data Representation - Number Systems 1.1(c) 2's Complement by Mr Bulmer's Learning Zone, generated from the public captions YouTube serves with the video. The transcript has 1,879 words across 333 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.