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