WEBVTT 00:00:17.270 --> 00:00:22.634 Welcome to the next video in the binary series. In the previous 00:00:22.634 --> 00:00:27.104 video we learned how to convert numbers to floating point 00:00:27.104 --> 00:00:33.362 notation. In this video I will show you how to do the other way 00:00:33.362 --> 00:00:37.832 around, so had to convert a floating point notation number 00:00:37.832 --> 00:00:42.302 back into ordinary decimal numbers. So let's say that you 00:00:42.302 --> 00:00:46.772 are given an 8 bits floating point notation, something like 00:00:46.772 --> 00:00:52.634 1001. 1011 OK, now the first step that you 00:00:52.634 --> 00:00:56.254 would do in here is break this code into it 00:00:56.254 --> 00:00:58.788 constituents break this code into its parts. 00:00:58.788 --> 00:01:02.408 Remember that the first bit is the sign bit. That's 00:01:02.408 --> 00:01:06.390 going to tell you if it's a positive or a negative 00:01:06.390 --> 00:01:08.200 number. The next 3 digits. 00:01:10.290 --> 00:01:11.700 Is your exponent? 00:01:13.000 --> 00:01:15.925 And this exponent, these 3 bits twos complement notation 00:01:15.925 --> 00:01:19.825 will tell you how many places you need to move the radix 00:01:19.825 --> 00:01:24.050 point either in to the right or to the left and the last 00:01:24.050 --> 00:01:25.675 part. The last four bits. 00:01:27.490 --> 00:01:29.509 Is your normalized? 00:01:31.430 --> 00:01:32.339 Month is self. 00:01:33.400 --> 00:01:39.224 This is the number that you will have to apply the exponent two 00:01:39.224 --> 00:01:41.912 and move the radix point into 00:01:41.912 --> 00:01:48.000 the right. Place to be able to decode the binary number so. 00:01:49.270 --> 00:01:56.359 Step one. Sign because the sign equals to one. We have got a 00:01:56.359 --> 00:01:57.856 negative number here. 00:02:01.500 --> 00:02:03.459 Then Step 2. 00:02:04.590 --> 00:02:10.796 Exponent Our exponent is 001. Well, that's a positive 00:02:10.796 --> 00:02:16.813 number because it starts with zero and it's positive one. So 00:02:16.813 --> 00:02:23.377 my exponent is positive one, so I will need to move my 00:02:23.377 --> 00:02:28.300 normalized mantissa one place into the positive direction that 00:02:28.300 --> 00:02:31.035 three. My normalized mantissa is 00:02:31.035 --> 00:02:36.174 0.1011. Apply the exponent two. It move the radix .1 00:02:36.174 --> 00:02:37.958 in the positive direction. 00:02:39.970 --> 00:02:47.120 So the number the binary number that is given to me here is 00:02:47.120 --> 00:02:53.720 one data .011. Now I need to decode it back into decimal. 00:02:54.930 --> 00:03:00.143 This is one that's the radix point. This is 1/2. This is 1/4 00:03:00.143 --> 00:03:04.955 and this is an 8. So what I have in here is. 00:03:05.470 --> 00:03:11.794 1 + 1/4 plus an 8. Remember, how can we act together? 00:03:11.794 --> 00:03:18.118 Fractions need to make them to be the same denominators, so it 00:03:18.118 --> 00:03:24.442 will be 1 + 2 eight +18, which is altogether one and 00:03:24.442 --> 00:03:30.506 three eights. And remember, we had one to start with, 00:03:30.506 --> 00:03:35.519 so 10011011 in eight bits floating point notation is 00:03:35.519 --> 00:03:41.089 the same as minus one and three eights in decimal. 00:03:44.280 --> 00:03:50.391 Let's look at the next example, which 00:03:50.391 --> 00:03:53.010 is 11011100 again. 00:03:58.010 --> 00:04:02.976 The first step is to identify the sign. Now the sign is 1 00:04:02.976 --> 00:04:06.496 again. So we have got a negative number. 00:04:09.070 --> 00:04:11.756 Then Step 00:04:11.756 --> 00:04:17.660 2. Find the exponent. 00:04:18.900 --> 00:04:24.180 Remember the exponent is 101 now. This is in three Bits 2's 00:04:24.180 --> 00:04:29.460 complement, so the 1st digit tells me that this is a negative 00:04:29.460 --> 00:04:34.740 number. So this is a negative exponent, so it went through the 00:04:34.740 --> 00:04:40.020 inversion process. So what I need to do to find out what 00:04:40.020 --> 00:04:44.420 positive equivalent is in here is to redo that inversion 00:04:44.420 --> 00:04:48.820 process, so copy the number until you copy the one. 00:04:49.340 --> 00:04:51.660 Then invert everything else. 00:04:52.280 --> 00:04:57.348 So that zero becomes one. This one becomes a 0, so this will be 00:04:57.348 --> 00:05:00.606 the positive equivalent of this negative number, and the 00:05:00.606 --> 00:05:03.502 positive equivalent in here using the place values. 00:05:04.200 --> 00:05:08.000 This is equal to 00:05:08.000 --> 00:05:14.640 R. Three, so this original number is negative three, so our 00:05:14.640 --> 00:05:16.624 exponent is negative 3. 00:05:17.230 --> 00:05:19.870 And that 3. 00:05:20.600 --> 00:05:22.550 Using the mantissa. 00:05:23.340 --> 00:05:30.370 Now the normalized mantissa is the last four bits. Remember, 00:05:30.370 --> 00:05:37.400 it's always starts with 0.1100, but what that Azar's done? 00:05:37.980 --> 00:05:42.831 The exponent was negative three, so the computer was stored to 00:05:42.831 --> 00:05:48.123 move it 3 places to the negative direction. So what does that 00:05:48.123 --> 00:05:51.980 mean? One place to place 00:05:51.980 --> 00:05:55.829 three places. Filling the zeros. 00:05:56.670 --> 00:06:04.166 So the original number was a very small 00:06:04.166 --> 00:06:07.914 number O radix .0001100. 00:06:08.590 --> 00:06:11.380 So what is this number? 00:06:12.060 --> 00:06:18.664 Use the place values again this is 1 radix point or half or 00:06:18.664 --> 00:06:25.268 quarter on 8R16R32 and the rest of them are zero, so we don't 00:06:25.268 --> 00:06:30.856 really need to bother about them. So this number here is 00:06:30.856 --> 00:06:35.428 basically the sum of the 16th and the 32. 00:06:35.980 --> 00:06:39.580 Again, how can I add fractions together? I need to 00:06:39.580 --> 00:06:43.540 make them to be the same denominator, so how can I 00:06:43.540 --> 00:06:47.500 make 30 twos from sixteens? I just need to double it. 00:06:48.920 --> 00:06:55.820 So it's altogether 3 / 32. And remember I had a negative 00:06:55.820 --> 00:07:00.420 number because my assignment was one so one. 00:07:00.950 --> 00:07:07.742 1011100 As an 8 bits floating point is exactly the same as 00:07:07.742 --> 00:07:10.006 minus 3 / 32. 00:07:12.900 --> 00:07:16.794 Let's do one more example of this floating point notation and 00:07:16.794 --> 00:07:19.272 let's look at what number is 0. 00:07:19.780 --> 00:07:23.890 101 1011 00:07:26.060 --> 00:07:29.504 Step one, find 00:07:29.504 --> 00:07:36.941 the sign. The first bit is 0, so this 00:07:36.941 --> 00:07:39.393 is a positive number. 00:07:40.910 --> 00:07:44.216 Then comes Step 00:07:44.216 --> 00:07:51.650 2. Using the exponent. 00:07:53.360 --> 00:07:55.139 Now our exponent. 00:07:55.770 --> 00:07:57.400 Is 101. 00:07:59.750 --> 00:08:01.500 Which is a negative number. 00:08:02.190 --> 00:08:06.654 So again, going through the inversion process copied the 00:08:06.654 --> 00:08:11.118 number until your Capital One, then invert everything else. 00:08:12.140 --> 00:08:15.398 And. This is again. 00:08:16.320 --> 00:08:20.401 Positive three so this is still negative. 3 The difference here 00:08:20.401 --> 00:08:25.224 now will be that my month is a is slightly different, so let's 00:08:25.224 --> 00:08:28.934 look at the last step and deal with the mantissa. 00:08:29.910 --> 00:08:36.326 So I'm normalized mantissa is 0.1011. The computer 00:08:36.326 --> 00:08:42.742 was told to move this mantissa or the 00:08:42.742 --> 00:08:48.770 radix point. Three in the negative direction, so it would 00:08:48.770 --> 00:08:51.120 need to move it 123. 00:08:51.720 --> 00:08:58.644 So 0.00. So the original 00:08:58.644 --> 00:09:04.812 number was 0.0001011. The accompanying place 00:09:04.812 --> 00:09:10.980 values are one radix point 1/2 00:09:10.980 --> 00:09:17.148 or quarter an 8 or 16 00:09:17.148 --> 00:09:20.232 or 3264 and 00:09:20.232 --> 00:09:27.538 128th. So I need to talk together. Now is 1 / 16 + 00:09:27.538 --> 00:09:34.498 1 / 64 + 1 / 128. Now again to be able to add them 00:09:34.498 --> 00:09:40.530 together I need to get them all to be the same denominator. Now 00:09:40.530 --> 00:09:45.634 this is a common denominator because I can get 228 from 00:09:45.634 --> 00:09:48.418 doubling all of them but at 00:09:48.418 --> 00:09:51.410 different numbers. So from. 00:09:53.010 --> 00:09:59.940 16 to get 228 what I've done. I doubled 123 times. So that is 00:09:59.940 --> 00:10:06.870 basically 16 * 8 going to give me the 128. So what this is 00:10:06.870 --> 00:10:14.790 telling me that 8 / 128 is the same as 1 / 1664 and 120. There 00:10:14.790 --> 00:10:21.720 is only one doubling point in here, so that is just 2 / 128. 00:10:21.920 --> 00:10:28.790 Plus 1 / 128, so this is altogether giving me 00:10:28.790 --> 00:10:35.660 8 + 2 is 10 plus one is 11 / 00:10:35.660 --> 00:10:41.156 128 so 01011011 in eight bits within point. 00:10:41.980 --> 00:10:46.608 Is the same as 11 / 128? Remember this time it was zero, 00:10:46.608 --> 00:10:50.880 so this is a positive number and for positive numbers we don't 00:10:50.880 --> 00:10:52.660 write out the positive sign. 00:10:53.620 --> 00:10:57.820 Now we went through the 8 bits floating point notation and you 00:10:57.820 --> 00:11:01.320 might find it still a little bit confusing. That's absolutely 00:11:01.320 --> 00:11:04.820 fine, because this is like an orchestra you pulling together 00:11:04.820 --> 00:11:07.970 everything that you've learned about binary numbers. So you 00:11:07.970 --> 00:11:11.120 putting together the two bits complement notation, some normal 00:11:11.120 --> 00:11:13.920 mathematical knowledge about moving decimal places applied 2 00:11:13.920 --> 00:11:18.820 in binary numbers and so on. So this is probably one of the most 00:11:18.820 --> 00:11:22.670 difficult questions that you can get in binary numbers, but once 00:11:22.670 --> 00:11:25.470 you understand them then you will really know. 00:11:25.550 --> 00:11:28.745 What needed to be known about this system, and 00:11:28.745 --> 00:11:32.295 you know how the computer looks at the binary code. 00:11:33.410 --> 00:11:38.350 And now it is your turn to try these conversions. You will find 00:11:38.350 --> 00:11:41.770 the answers to these questions shortly after the questions 00:11:41.770 --> 00:11:45.118 appear. So these are the practice questions. 00:11:50.860 --> 00:11:52.820 And here are the answers.