YouTube2Text

IGCSE Computer Science 2023-25 - (1) Data Representation - Number Systems 1.1(c) 2's Complement — Transcript

by Mr Bulmer's Learning Zone · 1,879 words · 333 segments · language en · Watch on YouTube

Full transcript

  1. 0:00okay welcome back everybody and we're
  2. 0:02going to be looking at the um the third
  3. 0:04and final part of 1.1 number systems
  4. 0:08following the new computer science igcse
  5. 0:11syllabus
  6. 0:12um in this we're going to be looking at
  7. 0:15how to add
  8. 0:16two positive eight bit numbers
  9. 0:18we're going to be looking at overflow
  10. 0:20when we and and how this is caused when
  11. 0:22we do add to positive 8-bit binary
  12. 0:25numbers we're going to look at logical
  13. 0:27shifts
  14. 0:28on positive
  15. 0:31binary numbers and how we can multiply
  16. 0:34binary numbers and divide binary numbers
  17. 0:36using this method
  18. 0:38we're then going to finish off with um
  19. 0:40something called two's complement to
  20. 0:42complement notation and this is new
  21. 0:44um to the to the new syllabus but this
  22. 0:47this allows us to represent both
  23. 0:49positive and negative
  24. 0:51binary numbers
  25. 0:53once we've done that we should be moving
  26. 0:54on sticking with the um data
  27. 0:56representation but we'll be moving on to
  28. 0:58text sound and images
  29. 1:02okay
  30. 1:03so
  31. 1:04adding binary numbers together
  32. 1:06well in the normal system in an idenary
  33. 1:09system would be
  34. 1:10adding we'll be looking at the units
  35. 1:12column first of all and if we have one
  36. 1:15plus two obviously that equals three
  37. 1:18it's only when we carry over and we
  38. 1:19maybe add nine plus four and we get four
  39. 1:22lots of units and one lot of ten that we
  40. 1:25can sort of draw on that and see
  41. 1:27similarities
  42. 1:28in the
  43. 1:29in the danery system
  44. 1:31so there are some rules
  45. 1:34and here we go we've got four rules
  46. 1:36um if we have zero plus zero obviously
  47. 1:39that's going to be a zero it's the same
  48. 1:40in any number system
  49. 1:42um one plus zero of course is still one
  50. 1:46but when we get to the next two one plus
  51. 1:48one would equal two
  52. 1:50which in binary would be one lot of two
  53. 1:52and no lots of ones
  54. 1:54and then if we have one plus one plus
  55. 1:56one obviously this is three but three is
  56. 1:59represented as um one lot of two and one
  57. 2:02lot of one
  58. 2:04so if we follow this method
  59. 2:07we can look at this sum we've we've got
  60. 2:08here this um
  61. 2:10eight bits
  62. 2:11um
  63. 2:13from two registers
  64. 2:15and register one and i've put register
  65. 2:16two underneath it as a simple sort of
  66. 2:18addition sum
  67. 2:20we can go step by step through this
  68. 2:22together
  69. 2:24so we have one plus zero obviously
  70. 2:26equals one
  71. 2:28now we get to the third rule
  72. 2:30one plus one
  73. 2:31is
  74. 2:32two
  75. 2:33but that would be
  76. 2:35no units no ones
  77. 2:38so we carry over the two
  78. 2:40so one plus one again we're going to do
  79. 2:42the same thing zero
  80. 2:44carry the one
  81. 2:45here we've only got one so we pop that
  82. 2:48into the um into into the answer
  83. 2:50one plus one again
  84. 2:52zero carry the one
  85. 2:54one plus one again
  86. 2:56zero carry the one and now we've got the
  87. 2:58final rule one plus one plus one
  88. 3:01obviously equals three so that's one lot
  89. 3:04of one
  90. 3:05and one lot of two that we carry over
  91. 3:07and we can put this into the final
  92. 3:09column to get the answer
  93. 3:11one one zero zero one zero zero one
  94. 3:16hopefully look at that you could you can
  95. 3:18remember how you might change this first
  96. 3:20of all into a idenary number how we
  97. 3:23could convert that and also if we would
  98. 3:26divide it in half
  99. 3:27i'm splitting into two nibbles how we
  100. 3:29might change this into an hexadecimal
  101. 3:33now if we were to change the first
  102. 3:36number
  103. 3:37the the first term the first digit
  104. 3:39in that first byte of information and
  105. 3:41change it to a one
  106. 3:43obviously when we add all these numbers
  107. 3:45together again we'd end up with
  108. 3:47something
  109. 3:48with a ninth bit something that's called
  110. 3:51an overflow
  111. 3:52um this obviously would lead to errors
  112. 3:55in the sense that we can't have
  113. 3:57nine digits nine numbers represented in
  114. 4:00an eight bit number system so we'd end
  115. 4:02up with problems there and the system
  116. 4:04might
  117. 4:05might crash or it might ignore
  118. 4:08that extra digit so you wouldn't get the
  119. 4:09correct answer
  120. 4:12i would then move on
  121. 4:14so logical binary shifts 1.1.5
  122. 4:20okay we're going to use this technique
  123. 4:23to shift numbers um left and right
  124. 4:26backwards and forwards in a register
  125. 4:30um
  126. 4:31obviously with binary numbers things
  127. 4:33need to be added together taken away
  128. 4:35removed
  129. 4:36but in this case we're going to be
  130. 4:38multiplying
  131. 4:39or dividing um bytes in this case of
  132. 4:43information
  133. 4:46so
  134. 4:48if we were to shift
  135. 4:50the numbers in this system i'll shift
  136. 4:53these ones and zeros across to the left
  137. 4:56we would be multiplying you'll see that
  138. 4:58in a moment and if we shift them to the
  139. 5:00right going down the radius so to speak
  140. 5:03then we will be dividing by two what
  141. 5:06does that mean
  142. 5:07we have a an eight bit register here
  143. 5:10below and it contains the daenery number
  144. 5:1221 you can see that it's one lot of 16
  145. 5:16one lot of four and one lot of one added
  146. 5:18together obviously 21.
  147. 5:21now if we shift these digits to the left
  148. 5:26if we move them
  149. 5:28one space
  150. 5:30okay
  151. 5:31um we're going to get one lot of 32
  152. 5:33one out of eight and one left two now
  153. 5:35that's obviously 42
  154. 5:38which would be twice
  155. 5:41the value of 21. so 21 times 2
  156. 5:44equals 42.
  157. 5:46when we're shifting we've got spaces we
  158. 5:48automatically put in a 0 into the end
  159. 5:51column now you mind some of you might
  160. 5:54see this and think
  161. 5:55ah this could cause problems and it does
  162. 5:58cause problems
  163. 5:59so as a bit shift an empty position
  164. 6:03is replaced with a zero and obviously
  165. 6:06there are limits in an 8-bit number
  166. 6:07system as to how many zeros you can put
  167. 6:09in before it completely zeros out
  168. 6:13so for example if i was to take this
  169. 6:15number here
  170. 6:16um one lot of 64 one of 32 and one love
  171. 6:1916 and i was to move this
  172. 6:23five places to the left
  173. 6:28then we would end up with um a register
  174. 6:30full of zeros okay but we've multiplied
  175. 6:33this number
  176. 6:34um and obviously when we multiply this
  177. 6:36number the equivalent of
  178. 6:38the value 1 1 2 or 112
  179. 6:41we're not when we times it by 2 and 2
  180. 6:44and 2 and 2 and 2 again
  181. 6:47we're not going to get
  182. 6:48purely zeros
  183. 6:51okay
  184. 6:52so here's some more examples
  185. 6:54um
  186. 6:56what we're going to do first of all
  187. 6:57write 24 into the 8-bit register well
  188. 7:00that's obviously um one lot of 16 and
  189. 7:03one lot of eight
  190. 7:05okay so that's that's straightforward we
  191. 7:07know that
  192. 7:08now we're going to shift to a logical
  193. 7:10shift going three places to the left
  194. 7:13so we're going up the register
  195. 7:16so
  196. 7:17shifting them one two three
  197. 7:20as you can see there is some
  198. 7:22times two
  199. 7:23times two times two
  200. 7:26which would equal
  201. 7:27192. so we've times it to um 24 times 2
  202. 7:32to the 3 which represents the three
  203. 7:34shifts
  204. 7:35okay 192.
  205. 7:37now if we go back to the existing
  206. 7:39um results the existing register which
  207. 7:41is 24 and we go
  208. 7:44two places to the right
  209. 7:47you can see there we've gone one two
  210. 7:49we're basically dividing so 24 divided
  211. 7:52by two to the two two shifts would equal
  212. 7:55six
  213. 7:56basically 24
  214. 7:58divided by 2 is 12 and divided by 2
  215. 8:01again would be 6.
  216. 8:04okay so that's how we multiply
  217. 8:06and divide using logical binary shifts
  218. 8:13okay and for the final bit we're going
  219. 8:14to be looking at two's complement
  220. 8:17on binary numbers how to represent
  221. 8:19negative integers
  222. 8:21um when we're using two's complement
  223. 8:24so in this section again like the others
  224. 8:25we're going to assume
  225. 8:27um the eight bit registers are being
  226. 8:29used for the
  227. 8:30in terms of the questions
  228. 8:33the only major difference
  229. 8:35that we're gonna we're gonna use in
  230. 8:37terms of these registers is we're going
  231. 8:39to change the heading of one of the
  232. 8:41numbers that being
  233. 8:43minus one to eight one two eight becomes
  234. 8:46minus one to eight
  235. 8:48of course that means that we no longer
  236. 8:49have
  237. 8:51255
  238. 8:53different character representations
  239. 8:56different sequences of ones and zeroes
  240. 8:58because we've got the minus one to eight
  241. 9:01this refers to
  242. 9:03everything
  243. 9:04which has a one under
  244. 9:06minus one to eight
  245. 9:08is a negative number
  246. 9:10everything with a zero under the minus
  247. 9:12one to eight
  248. 9:13is a positive number so we basically
  249. 9:15split
  250. 9:17two five five
  251. 9:18into two into two halves
  252. 9:21the positives being 0 up to 1 127
  253. 9:25and the negatives being minus 128 all
  254. 9:29the way up to minus 1.
  255. 9:33and here we can see that minus 128 would
  256. 9:36be one lot of minus 128 and nothing in
  257. 9:40the other
  258. 9:41columns
  259. 9:42whereas plus 127
  260. 9:44the sort of biggest positive number we
  261. 9:46can have would be no loss of 128
  262. 9:50and all the rest of the um the columns
  263. 9:53being filled in with ones
  264. 9:57it is important to realize when applying
  265. 9:59two's complement to a binary number that
  266. 10:02the leftmost bit always determines the
  267. 10:04sign of the binary number as i've just
  268. 10:07said a one value in the leftmost bit
  269. 10:09indicates a negative number and a zero
  270. 10:11value in the left most bit indicates a
  271. 10:14positive number i can't emphasize this
  272. 10:16enough i'm going to try and show you a
  273. 10:18number here
  274. 10:19um a representation of 51.
  275. 10:22and of course if we look at this you
  276. 10:24look and see okay we've got one lot of
  277. 10:2532 one lot of 16
  278. 10:28a two and a one
  279. 10:30it's exactly the same as how you would
  280. 10:32normally do it there are no
  281. 10:34negative 128s there are no positive 128s
  282. 10:37in the same way there's no 64s
  283. 10:40um it is exactly the same
  284. 10:43so if we want to represent the number
  285. 10:45minus 49
  286. 10:48we're going to put a 1 under the minus
  287. 10:49128 this shows that it's a minus number
  288. 10:52and we're going to start with that
  289. 10:54number minus 128. we're then going to
  290. 10:56add to it
  291. 10:58positive 64.
  292. 11:00positive 64 plus minus 128 would give us
  293. 11:04minus 64.
  294. 11:06if we then add positive 8
  295. 11:08to minus 64
  296. 11:10we would get minus 56
  297. 11:12at positive 4 we would get minus 52
  298. 11:15add positive 2 would get minus 50 and
  299. 11:18finally add positive 1
  300. 11:20and we would get minus 49 and this is
  301. 11:24how we rep how we represent
  302. 11:26the minus numbers we're adding the
  303. 11:29positive numbers
  304. 11:30the ones in greens you can see here to
  305. 11:32the minus 128.
  306. 11:37well that's it that's how you would do
  307. 11:41the two's complement representation of
  308. 11:42negative numbers
  309. 11:45so
  310. 11:46have a practice
  311. 11:47good luck with that and remember if
  312. 11:49there's a one there
  313. 11:51it's a minus number and if there's a
  314. 11:53zero it is a positive number but the
  315. 11:56question will always say
  316. 11:58this
  317. 11:59is a representation of a two's
  318. 12:01complement binary number
  319. 12:04that's it for now
  320. 12:05thank you very much indeed um that as i
  321. 12:08said at the beginning is the end
  322. 12:11of this little bit 1.1
  323. 12:15so thank you very much for watching
  324. 12:17next time the next video will be 1.2
  325. 12:20text sound and images
  326. 12:22if you haven't already please subscribe
  327. 12:24i will be doing these as quickly as
  328. 12:26possible i'm trying for
  329. 12:28one video a week but
  330. 12:30um bear with me
  331. 12:32so um thank you very much indeed and i
  332. 12:34will see you next time
  333. 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.