0:00:20.340,0:00:24.685 In this video, we're going to[br]look at the binary fractions 0:00:24.685,0:00:29.030 again, but from a slightly[br]different angle. I will show you 0:00:29.030,0:00:32.585 an alternative method to convert[br]decimal fractions into binary 0:00:32.585,0:00:37.325 fractions, which will work in[br]most cases. I will show you some 0:00:37.325,0:00:41.275 examples, and again I will draw[br]your attention to the 0:00:41.275,0:00:42.855 limitations of this method. 0:00:43.580,0:00:49.768 So let's look at an example. So[br]what happens if you would need 0:00:49.768,0:00:55.480 to convert 13.3125 into binary?[br]From here on, I'm going to split 0:00:55.480,0:01:00.716 the number I'm going to convert[br]the whole number and the 0:01:00.716,0:01:05.476 fraction part separately. The[br]whole number 413. We're going to 0:01:05.476,0:01:10.236 use the normal way of converting[br]decimal numbers into binary's, 0:01:10.236,0:01:13.092 so use the place where you 0:01:13.092,0:01:20.649 table. 124 eight 16 So what[br]combination of these makes up 13 0:01:20.649,0:01:28.317 while 8 + 4 makes 12[br]+ 1 makes 13, so the 0:01:28.317,0:01:33.429 whole part of this decimal[br]fraction is 1101. 0:01:34.500,0:01:38.855 How about the decimal part? What[br]I'm going to do now? I'm going 0:01:38.855,0:01:41.535 to just separately right down[br]the decimal part. 0:01:43.410,0:01:48.846 And the trick is here to keep[br]doubling the number. So what's 0:01:48.846,0:01:51.111 the double of three 125? 0:01:51.840,0:01:57.524 Double of five is 10, carried[br]A1 double of two is 4 + 1 0:01:57.524,0:02:03.614 makes 5 double of two is 2 and[br]double of three is 6. Now what 0:02:03.614,0:02:08.892 happened in here is that I do[br]not have any overflow into the 0:02:08.892,0:02:13.358 whole number part of this part[br]of the structure and therefore 0:02:13.358,0:02:17.012 I'm going to record 0 after[br]the radix point. 0:02:18.320,0:02:22.940 Then I'm going to keep doubling.[br]Obviously double of 00, so I 0:02:22.940,0:02:28.715 don't even need to think about[br]that. 2 * 5 is 10, carried A one 0:02:28.715,0:02:36.030 2 * 2 is 4 + 1 makes it five.[br]2 * 6 is 12. So record the two 0:02:36.030,0:02:41.035 and the one is an overflow. So[br]this digit. Now I'm going to 0:02:41.035,0:02:44.885 pick up and record as the 2nd[br]digit of the. 0:02:45.750,0:02:46.940 Binary fraction. 0:02:48.620,0:02:53.060 Imagine like if you were picking[br]this one up from here recorded 0:02:53.060,0:02:57.870 here. So from now it disappears.[br]The next step that I'm going to 0:02:57.870,0:03:02.310 do, I'm going to double again,[br]but without the whole part. So 0:03:02.310,0:03:04.160 I'm just going to 55. 0:03:05.080,0:03:10.488 Which may extend double of two[br]is 4 + 1 is 5 and there again I 0:03:10.488,0:03:14.544 have got no overflow into the[br]whole parts, so I'm going to 0:03:14.544,0:03:15.896 record a 0 here. 0:03:17.150,0:03:20.258 Double again 2 * 5 is 10. 0:03:22.330,0:03:26.410 There is an overflow. This is my[br]last digit here because from 0:03:26.410,0:03:30.150 here on I've got no more[br]fractional parts, so you stop 0:03:30.150,0:03:34.570 when you end up with a zero in[br]the fractional part. Now pulling 0:03:34.570,0:03:35.590 the two together. 0:03:36.270,0:03:43.398 13.3125, in decimal[br]is the same 0:03:43.398,0:03:50.526 as 1101 Radix[br].0101 in binary. 0:03:56.110,0:04:02.518 The second example is[br]9.1875. Again separates the 0:04:02.518,0:04:08.926 number into whole and[br]fractional part. The whole 0:04:08.926,0:04:11.329 part is 9. 0:04:12.300,0:04:19.710 Which is 8 + 1, so eight[br]no four, no two and one. 0:04:21.560,0:04:23.148 The decimal part now. 0:04:23.690,0:04:29.934 0.1875 Let's keep doubling it. 2[br]* 5 is 10 carry one. 2 * 0:04:29.934,0:04:37.070 7 is 14 + 1 makes it 15[br]carried A one 2 * 8016 + 1 0:04:37.070,0:04:44.206 is 17, carried A one. 2 * 1[br]is 2 + 1 is 3 again. I 0:04:44.206,0:04:49.558 did not have any overflow into[br]the whole number part, so the 0:04:49.558,0:04:54.464 1st digit behind the radix point[br]that I'm going to record. 0:04:54.500,0:04:55.358 Is a 0. 0:04:56.590,0:04:57.720 Double again. 0:04:58.790,0:05:06.296 2 * 5 is 10, carried a warm 2[br]* 7 is 14 + 1 makes it 15. 0:05:06.296,0:05:12.551 Carry the one 2 * 3 is 6 +[br]1, seven again no overflow into 0:05:12.551,0:05:16.721 the whole part. So I'm going to[br]record 0 here. 0:05:17.460,0:05:24.225 Double again 2 * 5 is 10.[br]Carried a wamp. 2 * 7 is 14 0:05:24.225,0:05:30.088 + 1 makes it 15. Now I have[br]gotten overflowing here, so I'm 0:05:30.088,0:05:31.892 going to record this. 0:05:32.470,0:05:36.551 As the next digit after the[br]radix point and then double 0:05:36.551,0:05:40.632 again, don't forget that this[br]one is not here anymore because 0:05:40.632,0:05:43.229 I picked up and recorded it in 0:05:43.229,0:05:47.060 here. So 2 * 5 is 10. 0:05:47.900,0:05:52.762 So the next digit is 1 again. So[br]for the two things together. 0:05:53.650,0:06:00.070 9.1875 in decimal[br]is the same 0:06:00.070,0:06:06.490 as 1001 radix[br].0011 in binary. 0:06:08.180,0:06:12.761 The next number is 0.6875.[br]Luckily, this number doesn't 0:06:12.761,0:06:18.869 have any whole parts, so we just[br]need to concentrate on the 0:06:18.869,0:06:24.468 decimal fraction part so I can[br]just simply keep doubling this 0:06:24.468,0:06:31.594 number. 2 * 5 is 10. Carry[br]one 2 * 7 is 14 + 0:06:31.594,0:06:38.211 1 is 15, carried A one 2[br]* 8016 + 1 is 17. 0:06:38.250,0:06:41.340 Either one 2 * 6 is. 0:06:41.970,0:06:45.633 12 + 1 is 13, so I've got an 0:06:45.633,0:06:49.490 overflow. So the 1st digit[br]I'm going to record behind 0:06:49.490,0:06:51.090 the radix point is 1. 0:06:54.730,0:07:01.336 Double 2 * 5 is 10, carried A[br]one 2 * 7 is 14 + 1 makes it 0:07:01.336,0:07:07.575 15. Carry the one 2 * 3 is 6 +[br]1. Seven this case I did not 0:07:07.575,0:07:12.346 have an overflow, so the next[br]day did after the radix point is 0:07:12.346,0:07:13.447 0 double again. 0:07:14.910,0:07:22.798 2 * 510 carried A one 2 *[br]7 is 14 + 1 makes it 15 0:07:22.798,0:07:28.714 overflow, so the next digit is[br]1. Remember that's gone now and 0:07:28.714,0:07:36.109 O makes no difference there. 2 *[br]5 is 10, so it's 1.0. So we 0:07:36.109,0:07:42.518 have got one more digit here,[br]which is a one so 0.6875 in 0:07:42.518,0:07:45.969 decimal. As the same is O radix 0:07:45.969,0:07:47.510 .1011. In binary. 0:07:50.520,0:07:55.260 Now let's look at a nice and[br]easy decimal number. The one 0:07:55.260,0:08:01.185 that we didn't quite know how to[br]deal with at the end of the last 0:08:01.185,0:08:05.925 video. So let's look at 3.4. So[br]let's separate the number again 0:08:05.925,0:08:11.060 in two whole and fractional[br]parts, so three is 2 + 1, which 0:08:11.060,0:08:16.590 is 1 one and the fractional[br]part. Let's just double 2 * 4 is 0:08:16.590,0:08:21.330 0.8, so after the radix point,[br]the 1st digit will be 0. 0:08:21.620,0:08:24.120 2 * 8 is 16. 0:08:24.660,0:08:28.020 So 1.6 the next digit is 1. 0:08:29.560,0:08:32.227 2 * 6 is 12, so 2. 0:08:32.740,0:08:35.680 .1 again carry the one. 0:08:37.310,0:08:44.534 Double of two is 4 no[br]carry, 004 is 8 again, no 0:08:44.534,0:08:51.156 overflow. Double F8 is 16 so[br]I've got one here now. 0:08:52.120,0:08:58.945 WF6 is 12. I've got another one[br]here. Now double F2 is 4. 0:09:00.040,0:09:05.804 Put down a zero and hold on.[br]I'm repeating myself look. 0:09:06.750,0:09:10.646 Point 4.8. 6248624862 0:09:10.646,0:09:18.035 so this.[br]Simple decimal fraction 3.4 is 0:09:18.035,0:09:23.102 an infinitely recurring binary[br]fraction, so that's again shows 0:09:23.102,0:09:28.732 you some difficulties when it[br]comes to converting that simple 0:09:28.732,0:09:33.236 fractions to binary fractions.[br]So this would be. 0:09:33.940,0:09:40.420 3.4 in decimal[br]would be 1 0:09:40.420,0:09:43.660 one radix .01100110. 0:09:44.170,0:09:47.970 212345678 places. 0:09:50.970,0:09:55.782 As I mentioned it in the last[br]video, this is something that's 0:09:55.782,0:09:59.391 fundamentally inherent property[br]of the binary number system. We 0:09:59.391,0:10:03.802 can't really do anything about[br]it, but by using more binary 0:10:03.802,0:10:07.812 digits to represent the decimal[br]numbers, we can minimize this 0:10:07.812,0:10:15.535 problem. Let's look[br]at another simple 0:10:15.535,0:10:21.416 example, 4.715. Separate[br]it again to whole and 0:10:21.416,0:10:27.019 fractional. Part 4 is just 100.[br]Remember this is 1, two and four 0:10:27.019,0:10:31.760 and the fractional part will be[br]0.715. Now let's keep doubling 0:10:31.760,0:10:38.656 it. 2 * 5 is then carried A1[br]three times, one is 2 + 1 is 0:10:38.656,0:10:45.552 three 2 * 7 is 14, so I've got[br]one of the overflow, so the 1st 0:10:45.552,0:10:49.431 digit in after the radix point[br]will be one. 0:10:49.490,0:10:53.901 Now those two unnecessary[br]anymore. So double again 2 * 3 0:10:53.901,0:10:59.916 is Six 2 * 4 is 8, so there[br]is no overflow. This digit will 0:10:59.916,0:11:01.119 be at 0. 0:11:02.090,0:11:08.516 Double it again. 2 * 6 is 12,[br]carried A one 2 * 8016 + 1 makes 0:11:08.516,0:11:12.674 17. I've got an overflow here[br]now, so that's number one. 0:11:13.470,0:11:20.529 Double it again. 2 * 2 is[br]four 2 * 7 is 14. 0:11:21.170,0:11:23.340 So next digit is 1. 0:11:24.230,0:11:30.080 Double against that digits gone[br]2 * 4 is eight 2 * 4 is 8 0:11:30.080,0:11:35.150 no overflow, so this digit[br]phobia, 0 double 2 * 8 is 16, 0:11:35.150,0:11:42.170 carried A one 2 * 8 is 16 + 1[br]is 17. So there is one as an 0:11:42.170,0:11:47.630 overflow that's gone. Now double[br]again 2 * 6 is 12, carried A one 0:11:47.630,0:11:54.260 2 * 7 is 14 + 1 makes it 15,[br]so I've got one as an overflow. 0:11:54.300,0:12:01.440 Double again 2 * 2 is[br]four 2 * 5 is 10. 0:12:01.970,0:12:04.190 Overflow, so that's another one 0:12:04.190,0:12:10.380 in there. Times 2 is 8000 is the[br]next digit? Well, I don't know 0:12:10.380,0:12:14.780 about you, but I'm getting[br]exhausted in here and look there 0:12:14.780,0:12:19.580 is not even a sign anywhere for[br]a repetition, so this function 0:12:19.580,0:12:23.580 looks even worse than the[br]previous one. And again just 0:12:23.580,0:12:28.780 look at it how simple this is in[br]decimal. So yes, the binary 0:12:28.780,0:12:32.780 number system indeed have got[br]quite a few limitations which 0:12:32.780,0:12:35.180 can get quite a bit annoying 0:12:35.180,0:12:39.500 well. What kind of things have[br]been discovered about the binary 0:12:39.500,0:12:43.380 number system? Well, basically[br]we know that not all decimal 0:12:43.380,0:12:46.872 fractions can be expressed as a[br]finite binary fraction. 0:12:46.872,0:12:50.752 Unfortunately, this cannot be[br]avoided, but can be minimized by 0:12:50.752,0:12:55.408 using more bids. Also, if you[br]look at the examples through the 0:12:55.408,0:13:00.064 video again, you can see that[br]the radix point is different for 0:13:00.064,0:13:03.944 different numbers, so the[br]position of the radix point is 0:13:03.944,0:13:05.884 changing from number to number. 0:13:05.930,0:13:09.857 That can get quite confusing for[br]the computer, but Luckily for 0:13:09.857,0:13:13.784 this problem we do have a[br]solution and that is the 0:13:13.784,0:13:17.711 floating point notation which we[br]will talk about in more details 0:13:17.711,0:13:21.638 in one of the following videos.[br]For now I've prepared some 0:13:21.638,0:13:26.279 examples for you, so please look[br]at them. Try them and you will 0:13:26.279,0:13:29.849 find the answers later, so these[br]are the practice questions. 0:13:35.580,0:13:37.560 And here are the answers.