1 00:00:17,270 --> 00:00:22,634 Welcome to the next video in the binary series. In the previous 2 00:00:22,634 --> 00:00:27,104 video we learned how to convert numbers to floating point 3 00:00:27,104 --> 00:00:33,362 notation. In this video I will show you how to do the other way 4 00:00:33,362 --> 00:00:37,832 around, so had to convert a floating point notation number 5 00:00:37,832 --> 00:00:42,302 back into ordinary decimal numbers. So let's say that you 6 00:00:42,302 --> 00:00:46,772 are given an 8 bits floating point notation, something like 7 00:00:46,772 --> 00:00:52,634 1001. 1011 OK, now the first step that you 8 00:00:52,634 --> 00:00:56,254 would do in here is break this code into it 9 00:00:56,254 --> 00:00:58,788 constituents break this code into its parts. 10 00:00:58,788 --> 00:01:02,408 Remember that the first bit is the sign bit. That's 11 00:01:02,408 --> 00:01:06,390 going to tell you if it's a positive or a negative 12 00:01:06,390 --> 00:01:08,200 number. The next 3 digits. 13 00:01:10,290 --> 00:01:11,700 Is your exponent? 14 00:01:13,000 --> 00:01:15,925 And this exponent, these 3 bits twos complement notation 15 00:01:15,925 --> 00:01:19,825 will tell you how many places you need to move the radix 16 00:01:19,825 --> 00:01:24,050 point either in to the right or to the left and the last 17 00:01:24,050 --> 00:01:25,675 part. The last four bits. 18 00:01:27,490 --> 00:01:29,509 Is your normalized? 19 00:01:31,430 --> 00:01:32,339 Month is self. 20 00:01:33,400 --> 00:01:39,224 This is the number that you will have to apply the exponent two 21 00:01:39,224 --> 00:01:41,912 and move the radix point into 22 00:01:41,912 --> 00:01:48,000 the right. Place to be able to decode the binary number so. 23 00:01:49,270 --> 00:01:56,359 Step one. Sign because the sign equals to one. We have got a 24 00:01:56,359 --> 00:01:57,856 negative number here. 25 00:02:01,500 --> 00:02:03,459 Then Step 2. 26 00:02:04,590 --> 00:02:10,796 Exponent Our exponent is 001. Well, that's a positive 27 00:02:10,796 --> 00:02:16,813 number because it starts with zero and it's positive one. So 28 00:02:16,813 --> 00:02:23,377 my exponent is positive one, so I will need to move my 29 00:02:23,377 --> 00:02:28,300 normalized mantissa one place into the positive direction that 30 00:02:28,300 --> 00:02:31,035 three. My normalized mantissa is 31 00:02:31,035 --> 00:02:36,174 0.1011. Apply the exponent two. It move the radix .1 32 00:02:36,174 --> 00:02:37,958 in the positive direction. 33 00:02:39,970 --> 00:02:47,120 So the number the binary number that is given to me here is 34 00:02:47,120 --> 00:02:53,720 one data .011. Now I need to decode it back into decimal. 35 00:02:54,930 --> 00:03:00,143 This is one that's the radix point. This is 1/2. This is 1/4 36 00:03:00,143 --> 00:03:04,955 and this is an 8. So what I have in here is. 37 00:03:05,470 --> 00:03:11,794 1 + 1/4 plus an 8. Remember, how can we act together? 38 00:03:11,794 --> 00:03:18,118 Fractions need to make them to be the same denominators, so it 39 00:03:18,118 --> 00:03:24,442 will be 1 + 2 eight +18, which is altogether one and 40 00:03:24,442 --> 00:03:30,506 three eights. And remember, we had one to start with, 41 00:03:30,506 --> 00:03:35,519 so 10011011 in eight bits floating point notation is 42 00:03:35,519 --> 00:03:41,089 the same as minus one and three eights in decimal. 43 00:03:44,280 --> 00:03:50,391 Let's look at the next example, which 44 00:03:50,391 --> 00:03:53,010 is 11011100 again. 45 00:03:58,010 --> 00:04:02,976 The first step is to identify the sign. Now the sign is 1 46 00:04:02,976 --> 00:04:06,496 again. So we have got a negative number. 47 00:04:09,070 --> 00:04:11,756 Then Step 48 00:04:11,756 --> 00:04:17,660 2. Find the exponent. 49 00:04:18,900 --> 00:04:24,180 Remember the exponent is 101 now. This is in three Bits 2's 50 00:04:24,180 --> 00:04:29,460 complement, so the 1st digit tells me that this is a negative 51 00:04:29,460 --> 00:04:34,740 number. So this is a negative exponent, so it went through the 52 00:04:34,740 --> 00:04:40,020 inversion process. So what I need to do to find out what 53 00:04:40,020 --> 00:04:44,420 positive equivalent is in here is to redo that inversion 54 00:04:44,420 --> 00:04:48,820 process, so copy the number until you copy the one. 55 00:04:49,340 --> 00:04:51,660 Then invert everything else. 56 00:04:52,280 --> 00:04:57,348 So that zero becomes one. This one becomes a 0, so this will be 57 00:04:57,348 --> 00:05:00,606 the positive equivalent of this negative number, and the 58 00:05:00,606 --> 00:05:03,502 positive equivalent in here using the place values. 59 00:05:04,200 --> 00:05:08,000 This is equal to 60 00:05:08,000 --> 00:05:14,640 R. Three, so this original number is negative three, so our 61 00:05:14,640 --> 00:05:16,624 exponent is negative 3. 62 00:05:17,230 --> 00:05:19,870 And that 3. 63 00:05:20,600 --> 00:05:22,550 Using the mantissa. 64 00:05:23,340 --> 00:05:30,370 Now the normalized mantissa is the last four bits. Remember, 65 00:05:30,370 --> 00:05:37,400 it's always starts with 0.1100, but what that Azar's done? 66 00:05:37,980 --> 00:05:42,831 The exponent was negative three, so the computer was stored to 67 00:05:42,831 --> 00:05:48,123 move it 3 places to the negative direction. So what does that 68 00:05:48,123 --> 00:05:51,980 mean? One place to place 69 00:05:51,980 --> 00:05:55,829 three places. Filling the zeros. 70 00:05:56,670 --> 00:06:04,166 So the original number was a very small 71 00:06:04,166 --> 00:06:07,914 number O radix .0001100. 72 00:06:08,590 --> 00:06:11,380 So what is this number? 73 00:06:12,060 --> 00:06:18,664 Use the place values again this is 1 radix point or half or 74 00:06:18,664 --> 00:06:25,268 quarter on 8R16R32 and the rest of them are zero, so we don't 75 00:06:25,268 --> 00:06:30,856 really need to bother about them. So this number here is 76 00:06:30,856 --> 00:06:35,428 basically the sum of the 16th and the 32. 77 00:06:35,980 --> 00:06:39,580 Again, how can I add fractions together? I need to 78 00:06:39,580 --> 00:06:43,540 make them to be the same denominator, so how can I 79 00:06:43,540 --> 00:06:47,500 make 30 twos from sixteens? I just need to double it. 80 00:06:48,920 --> 00:06:55,820 So it's altogether 3 / 32. And remember I had a negative 81 00:06:55,820 --> 00:07:00,420 number because my assignment was one so one. 82 00:07:00,950 --> 00:07:07,742 1011100 As an 8 bits floating point is exactly the same as 83 00:07:07,742 --> 00:07:10,006 minus 3 / 32. 84 00:07:12,900 --> 00:07:16,794 Let's do one more example of this floating point notation and 85 00:07:16,794 --> 00:07:19,272 let's look at what number is 0. 86 00:07:19,780 --> 00:07:23,890 101 1011 87 00:07:26,060 --> 00:07:29,504 Step one, find 88 00:07:29,504 --> 00:07:36,941 the sign. The first bit is 0, so this 89 00:07:36,941 --> 00:07:39,393 is a positive number. 90 00:07:40,910 --> 00:07:44,216 Then comes Step 91 00:07:44,216 --> 00:07:51,650 2. Using the exponent. 92 00:07:53,360 --> 00:07:55,139 Now our exponent. 93 00:07:55,770 --> 00:07:57,400 Is 101. 94 00:07:59,750 --> 00:08:01,500 Which is a negative number. 95 00:08:02,190 --> 00:08:06,654 So again, going through the inversion process copied the 96 00:08:06,654 --> 00:08:11,118 number until your Capital One, then invert everything else. 97 00:08:12,140 --> 00:08:15,398 And. This is again. 98 00:08:16,320 --> 00:08:20,401 Positive three so this is still negative. 3 The difference here 99 00:08:20,401 --> 00:08:25,224 now will be that my month is a is slightly different, so let's 100 00:08:25,224 --> 00:08:28,934 look at the last step and deal with the mantissa. 101 00:08:29,910 --> 00:08:36,326 So I'm normalized mantissa is 0.1011. The computer 102 00:08:36,326 --> 00:08:42,742 was told to move this mantissa or the 103 00:08:42,742 --> 00:08:48,770 radix point. Three in the negative direction, so it would 104 00:08:48,770 --> 00:08:51,120 need to move it 123. 105 00:08:51,720 --> 00:08:58,644 So 0.00. So the original 106 00:08:58,644 --> 00:09:04,812 number was 0.0001011. The accompanying place 107 00:09:04,812 --> 00:09:10,980 values are one radix point 1/2 108 00:09:10,980 --> 00:09:17,148 or quarter an 8 or 16 109 00:09:17,148 --> 00:09:20,232 or 3264 and 110 00:09:20,232 --> 00:09:27,538 128th. So I need to talk together. Now is 1 / 16 + 111 00:09:27,538 --> 00:09:34,498 1 / 64 + 1 / 128. Now again to be able to add them 112 00:09:34,498 --> 00:09:40,530 together I need to get them all to be the same denominator. Now 113 00:09:40,530 --> 00:09:45,634 this is a common denominator because I can get 228 from 114 00:09:45,634 --> 00:09:48,418 doubling all of them but at 115 00:09:48,418 --> 00:09:51,410 different numbers. So from. 116 00:09:53,010 --> 00:09:59,940 16 to get 228 what I've done. I doubled 123 times. So that is 117 00:09:59,940 --> 00:10:06,870 basically 16 * 8 going to give me the 128. So what this is 118 00:10:06,870 --> 00:10:14,790 telling me that 8 / 128 is the same as 1 / 1664 and 120. There 119 00:10:14,790 --> 00:10:21,720 is only one doubling point in here, so that is just 2 / 128. 120 00:10:21,920 --> 00:10:28,790 Plus 1 / 128, so this is altogether giving me 121 00:10:28,790 --> 00:10:35,660 8 + 2 is 10 plus one is 11 / 122 00:10:35,660 --> 00:10:41,156 128 so 01011011 in eight bits within point. 123 00:10:41,980 --> 00:10:46,608 Is the same as 11 / 128? Remember this time it was zero, 124 00:10:46,608 --> 00:10:50,880 so this is a positive number and for positive numbers we don't 125 00:10:50,880 --> 00:10:52,660 write out the positive sign. 126 00:10:53,620 --> 00:10:57,820 Now we went through the 8 bits floating point notation and you 127 00:10:57,820 --> 00:11:01,320 might find it still a little bit confusing. That's absolutely 128 00:11:01,320 --> 00:11:04,820 fine, because this is like an orchestra you pulling together 129 00:11:04,820 --> 00:11:07,970 everything that you've learned about binary numbers. So you 130 00:11:07,970 --> 00:11:11,120 putting together the two bits complement notation, some normal 131 00:11:11,120 --> 00:11:13,920 mathematical knowledge about moving decimal places applied 2 132 00:11:13,920 --> 00:11:18,820 in binary numbers and so on. So this is probably one of the most 133 00:11:18,820 --> 00:11:22,670 difficult questions that you can get in binary numbers, but once 134 00:11:22,670 --> 00:11:25,470 you understand them then you will really know. 135 00:11:25,550 --> 00:11:28,745 What needed to be known about this system, and 136 00:11:28,745 --> 00:11:32,295 you know how the computer looks at the binary code. 137 00:11:33,410 --> 00:11:38,350 And now it is your turn to try these conversions. You will find 138 00:11:38,350 --> 00:11:41,770 the answers to these questions shortly after the questions 139 00:11:41,770 --> 00:11:45,118 appear. So these are the practice questions. 140 00:11:50,860 --> 00:11:52,820 And here are the answers.