 Assalamu alaikum students. I am Vasim Iqram. This is the third lecture in a series of 45 lectures on digital logic design. I hope you have looked at the examples and done exercises mentioned at the end of the chapter on number system. Let's start today's lecture by reviewing and revising the main topics discussed in the last lecture. In the last lecture, we talked about converting numbers from binary to decimal and from decimal to binary. Well, we discussed a number of methods, but the two main methods are the sum of weight method and the repeated division. Sum of weight method you would use to convert a number in any number system into decimal. So, you know you write an expression in terms of the base number and weights. Ultimately, you solve the expression and you get the equivalent decimal number. Converting from decimal to binary uses the repeated division by two method. So, you have a decimal number, you divide it by two, you get a quotient value, you get a remainder. If you note down the remainder, you divide the quotient value again by two. So, you keep on dividing the quotient value by two until you get a quotient value which is zero. That indicates the end of conversion. You write out the remainder values that gives you the binary equivalent of the decimal number. The next important topic which we discussed in the last lecture was binary arithmetic. We discussed binary addition, binary subtraction, multiplication and division. Now, all these four operations were very similar to the arithmetic operations which we performed with decimal numbers. For example, in the addition, a carry is generated. Well, when you perform addition with decimal numbers, a carry is generated. Similarly, when you perform binary subtraction, you have to borrow. If the number which you are subtracting is greater than the other number. Similarly, in decimal number system, you have to borrow sometimes. You have to be careful that in binary number system, you are dealing with binary numbers. Whereas, decimal number systems, you are dealing with decimal numbers. The other thing which we discussed was multiplication and division by constant numbers. So, how do you multiply a number, let us say by two? Well, in the case of binary numbers, if you shift left a number by one digit, that is like multiplying it by two. So, if you shift a binary number twice towards left, that is like multiplying by four. How do you divide by two? Well, if you shift the binary number towards right by one bit or one digit, that is like dividing by two. If you shift the binary number right by two bits, that is like dividing by four. In fact, in the last lecture, I mentioned an example. The number was 101 and I mentioned if you shift that number by two bits towards right, what do you get? You get 1.01 and the answer was 1.25. In the last lecture, I mentioned that it was 0.101. I hope you caught the error. The third important topic which we discussed in the last lecture was representing binary numbers. We talked about three different ways of representing binary numbers. The first one was the unsigned representation. We said that up till now, we have been dealing with only positive numbers. We assume that they are all positive numbers. So, we do not need to put a positive sign. The second method was the signed magnitude representation. In all practical cases, we would be dealing with positive numbers as well as negative numbers. So, we need to have a sign indicating if the number is positive or negative. Now, we said in a binary number system or digital systems do not or cannot represent a positive sign or a negative sign. Everything has to be represented in terms of 1s and 0s. So, in the signed magnitude representation, the most significant bit, the most significant left bit represents the sign. If it is set to 1, it indicates a negative number. If it is set to 0, it indicates a positive number. We talked about the 2s complement representation. Again, 2s complement representation allows you to represent positive as well as negative numbers. Now, positive numbers are represented in their original form in 2s complement. So, for example, the most significant bit would be a 0 representing the sign which is positive and the least significant bits would be representing the magnitude of the number. Negative numbers are represented in their 2s complement form. So, consider the number 13, it is 0, 1, 1, 0, 1. So, how would you represent it? In its 2s complement form, you have to take its 1s complement. So, what is the 1s complement of positive 13? It is 1, 0, 0, 1, 0. That is, you invert all the bits. Now, how do you take the 2s complement? You just add a 1 to the 1s complement of 13. That would give you 1, 0, 0, 1 and 1. Now, last time, we looked at addition and subtraction using numbers represented in their 2s complement form. Now, why did we do that? What is the important thing about 2s complement numbers? Let us consider an example. Let us repeat the same subtractions and additions using numbers represented in their signed magnitude form. Consider the 4 addition and subtraction operations as shown in the last lecture. The 4 operations are sum of 5 and 2, which results in 7. Sum of minus 5 and minus 2, which results in minus 7. Sum of plus 5 and minus 2, or you subtract 2 from 5, the result is positive 3. And the 4th operation, sum of minus 5 and 2, which results in minus 3. Or you could say it is 2 minus 5. Now, all these numbers are represented in their 2s complement form. The results are also in their 2s complement form. For example, the addition of minus 5 and minus 2 results in minus 7. In terms of binary, you see the number 1, 1, 0, 0, 1. The most significant bit is the carry bit. It can be neglected. So, you end up with the number 1, 0, 0, 1. Now, this is not minus 7. In fact, it is 2s complement of 7. Similarly, when you add minus 5 and plus 2, you get the result minus 3. 1, 1, 0, 1 is 2s complement of 3. It is in fact representing minus 3. Now, let us perform these addition and subtraction operations using the same set of numbers represented in their signed magnitude form. So, let us consider the first operation, the addition of plus 5 and plus 2. Now, in the signed binary representation plus 5 is 0, 1, 0, 1. The most significant bit is 0, which represents the sign. And the least 3 significant bits represent the magnitude, the number 5. Similarly, plus 2 is represented in its signed magnitude form. The result is plus 7. In terms of binary, it is 0, 1, 1, 1. The most significant bit, which is 0, represents the positive symbol or the positive sign. And the least significant 3 bits are all 1s, which represent the magnitude 7. Let us consider the second example, addition of minus 5 and minus 2. The result is minus 7. Now, minus 5 is represented in its signed magnitude form as 1, 1, 0, 1. The most significant bit 1 represents the negative sign. The last 3 bits 1, 0, 1 represent the magnitude. So, it is 5. Similarly, minus 2 is represented as 1, 0, 1, 0. The most significant bit 1 represents the negative sign. And the last 3 bits 0, 1, 0 represent the magnitude 2. Now, if you look at the answer, the answer does not represent minus 7. Minus 7 should be represented in its signed magnitude form as 1, 1, 1, 1. But here, you can see 0, 1, 1, 1. If you neglect the carry, this represents positive 7, which is incorrect. Let us consider this third case. We are adding 5 to minus 2, or rather we are subtracting 2 from 5. Now, 5 is represented as 0, 1, 0, 1 in its signed magnitude form. Similarly, minus 2 is represented as 1, 0, 1, 0. Now, what should be the answer? It is, of course, plus 3 and in its signed magnitude form, the number should be 0, 0, 1, 1. But here, you can see it is 1, 1, 1, 1. So, the answer has to be converted into the signed magnitude form. Let us consider the fourth case. Minus 5 is being added to 2, or you are performing a subtraction operation. 5 is being subtracted from 2. The answer is minus 3. Now, minus 3 is represented in its signed magnitude form as 1, 0, 1, 1. But here, the answer is 1, 1, 1, 1. In fact, adding 5 to minus 2 gives you the answer 1, 1, 1, 1. And adding 2 to minus 5 again gives you the same answer. So, both answers are not in their correct form. If you compare the 2's complement subtraction and addition, you find the answers to be in their correct 2's complement form. Now, what did you observe when you compared the subtraction and addition operations on the same set of numbers using 2's complement representation and 2's magnitude, sorry, signed magnitude representation? Well, in the case of 2's complement addition and subtraction, the result was always correct. Of course, it was represented in its 2's complement form, but if you converted into decimal, you would get the correct answer in decimal. Now, considering the signed magnitude representation, the answer in 2 cases was not correct, rather 3 cases was not correct. So, in order to get the correct answer, you have to do some sort of conversion. Now, let's suppose your digital system is adding or subtracting numbers represented in their signed magnitude form. Well, the answer would not be correct. You don't need to have an extra step where the numbers are changed or converted into their correct form. In the case of 2's complement, the number would always be correct. Now, what is the second advantage of representing numbers in 2's complement? Well, as you have seen, you don't need to subtract. You simply perform add operations. Well, you can add 2 positive numbers. You can add a positive number and a negative number or you could simply add 2 negative numbers. The result is always correct. Now, let's suppose you are designing a calculator which only performs add operations and subtract operations. So, in that particular calculator, if you are using 2's complement representation, you would only require a single adder circuit. You would not require a separate subtractive circuit. Let us now consider the range of numbers which can be added and subtracted. Last time, we looked at representing positive numbers from 7 to negative numbers up to minus 8 using the unsigned representation, the signed magnitude representation and the 2's complement representation. Now, in the case of unsigned representation, you can only represent positive numbers. So, from 0 to 7 numbers, positive numbers can be represented and you only require 3 bits. In the case of signed magnitude representation, you can only represent numbers from positive 7 to negative 7 and 4 bits are required. The most significant bit represents the sign. It's 1 for negative numbers and it's 0 for positive numbers. In the case of 2's complement representation, the range of numbers which can be represented using 4 bits, it's from plus 7, positive 7 to minus 8. Now, can you add 2 and minus 7 using unsigned number representation? Well, the answer is no. Why? Because you cannot represent a negative number in unsigned representation. Now, can you add 2 and 7? Well, the answer is 9. In unsigned number representation, which we have just discussed using 3 bits, the maximum positive number which you can represent is 7. So, 2 plus 7 would give you 9, which of course, you cannot represent using 3 bits. If you had 4 bits to represent unsigned numbers, then of course, you could have added 2 and 7. So, all the representations have a certain maximum range. Let's take the 2's complement representation. We have been using 4 bits. So, what can you, let's say, add minus 1 and minus 9? The answer is no, because you would get minus 10 and it cannot be represented using 4 bit 2's complement representation. Let's have a look at some examples which help us in determining if an overflow has occurred in the case of 2's complement number representation. Considering the 4 bit 2's complement representation, the maximum negative number which we can represent is minus 8. So, let's add minus 5 and minus 3. The answer is minus 8. As you can see, the 2's complement binary representation is 1, 1, 0, 0, 0. If you discard the carry, the answer is 1, 0, 0, 0, which in fact correctly identifies minus 8 in its 2's complement form. Now, let's add minus 5 and minus 4. The answer is minus 9. The answer, as you can see, is 1, 0, 1, 1, 1. Now, if you neglect the carry, what did you get? It's 0, 1, 1, 1. Now, if you observe the answer, you see a 0 in the most significant bit, which indicates a positive number, which is incorrect. The answer is minus 9. Now, if you observe the most significant bits of minus 5 and minus 4, they are both 1's. What do these bits indicate? The bits indicate that both the numbers are negative. So, if you add two negative numbers, the result should be negative. But in this particular case, you see a 0 as the sign bit for negative 9, which is incorrect. Consider another example. Let's add positive 5 and positive 4. The answer is 9. Now, the 2's complement representation of 9 gives you 1, 0, 0, 1. Now, observe the sign bit. It is 1, which means the number is negative, which is incorrect. So, when you add two negative numbers using 2's complement representation, the answer should be, again, a negative number. So, the sign bits of the two input numbers and the sign bit of the output number should be the same. Now, if you add two positive numbers, the result should be positive. So, the sign bits of the two inputs as well as the result should all be 0's. Now, if you add two negative numbers and the result somehow comes out to be positive, that indicates an overflow. So, the number is too large to be represented by the 2's complement representation. So, either you increase the number of bits to allow you to represent larger numbers or you just discard the result. Now, let us find out what is the largest number which a digital system can represent, like your calculator or your computer. Well, computers can easily handle 64-bit unsigned numbers. So, what is the value in terms of decimal? Well, if you consider two bits to represent an unsigned number, what is the largest value in decimal? Well, it is 2 raised to power 2, 2 bits minus 1. So, the largest number which you can represent using two binary bits is 3. Now, a computer, as I have said, can represent numbers using 64 bits. So, what is the largest number? It is 2 raised to power 64 minus 1. That is quite a large number, something into 10 raised to power 18. Now, your calculator or your computer would like to represent very large numbers or very small numbers or numbers which have an integer part and a fraction part. Now, the three different representations, the unsigned, the signed magnitude and the two's complementary representation, they all handle only integer numbers within a specified range. Now, in digital systems, we have a floating-point notation which allows us to represent very large numbers, very small numbers and numbers which have an integer part and a fraction part. There is a standard which is known as the ANSI IEEE 754 standard which defines the format of the single precision 32-bit floating-point number. Now, what is the exact format? Well, the most significant bit is used to represent the sign of the number. The next 8 bits are used to represent the exponent part of the number and the remaining 23 bits are used to represent the mantissa or the fraction. So, in fact, the number, very large numbers or very small numbers are written in the exponential form. Let us have a look how we would be writing large numbers or small numbers using this particular floating-point format. To help us in understanding this 32-bit single precision floating-point format, let us consider the example of a decimal number represented in a similar format. Let us have a decimal format which is 15 digits long. Similar to the 32-bit floating-point format, you have a single digit which represents the sign of the decimal number. You have two bits or rather two digits which represent the exponent. In the 32-bit floating-point format, we had 8 bits which represent the exponent. The remaining 12 bits in the decimal format represent the fraction part or the mantissa. In the 32-bit binary floating-point representation, we had 23 bits which represent the mantissa or the fraction part. Now, let us have a look at an example of a decimal number which has an integer part and a fraction part. Let us represent it using this 15-digit decimal floating-point representation. The 15-digit decimal floating-point representation has its most significant digit representing the sign digit. The next two digits represent the exponent digits and the last 12 digits represent the mantissa or the fraction part. Consider the number 6918.3125. This can be written in an exponential form. 6.9183125 into 10 power 3. Now, what is the magnitude of this number? The magnitude is 69183125. What is the exponent? It is 3. The number is written in its normalized form. What do we mean by normalized form? We bring the decimal point to the extreme left of the number. Now, the decimal number is written as 0.69183125 into 10 power 4. The magnitude remains the same. It is 69183125. The exponent is 4. Now, how do we represent this number using the 15-digit floating-point decimal representation? Well, the most significant digit has the positive sign indicating that this number is positive. The next two digits have the value 4, which represents the exponent. The last 12 digits have the number 69183125, remaining digits are set to 0. Now, what is the largest number which you can represent using this 15-digit floating-point representation? Well, the number is if you consider the exponent part, the exponent is 99. If you consider the fraction or the mantissa part, you have 12 9s. So, 12 9s into 10 power 99. That is the maximum number which you can represent using this 15-digit decimal floating-point representation. Now, how do you represent the value 0 using this decimal representation? Well, if the mantissa or the fraction part is set to 0, whatever the exponent part, the number is 0. Now, can you represent a very small number using this 15-digit decimal floating-point representation? Well, the answer is no. The smallest number which you can represent is 0. So, how do we represent smaller numbers smaller than 0? And secondly, exponents can be positive as well as negative. Now, the 2-digit field which represents the exponent can only represent positive exponents from 0 to 99. So, what is the solution to this? Well, you have two options to represent a negative exponent. The first option is to increase the exponent field to 3 digits. So, the first digit would represent the sign of the exponent and the remaining 2 digits would be representing the magnitude. So, you could have plus 99 exponent or minus 99 exponent. Now, if you increase the digit to represent positive as well as negative exponents, you have increased the total size of the decimal floating-point to 16 digits. The second option is to reduce the range of exponents which you can represent. How can we do that? We used a biased 50 counting method. What is the biased 50 counting method? Let us suppose the exponent which you need to represent is 49. Now, instead of writing 49 in the 2 digits meant for the exponent field, you add the biased number 50 to 49 which gives you 99. Let us consider a negative exponent such as minus 1. Instead of writing minus 1 directly in the 2-digit exponent field, you add a biased value 50 to minus 1 which gives you 49. So, you write 49 in the 2-digit exponent field. Now, if we use the second option, the biased 50 option to represent the exponent, what is the range of exponent values which we can have? Well, the positive, the maximum positive exponent can be 49 because if you add 50 to 49, you get a value of 99 which you can place in the 2-digit exponent field. What is the smallest exponent value which you can use? Well, you are going to be adding the biased 50 value to the actual exponent. So, let us suppose the actual exponent which you need to represent is minus 50. When you add the biased value which is 50, you end up with 0. So, the range of exponents which you can represent using a 2-digit exponent field is from positive 49 to minus 50. We have still not solved the problem of representing the number infinity. When you divide something by 0, you get an infinite number. Now, this floating point representation should have a mechanism to represent the infinite number. Do you have any idea how we can represent the number infinite using this 15-digit decimal representation? Well, the solution to this is that we reserve the exponent 99 to represent the number infinite. How do we do that? Well, again we have two options. Either we allow the maximum positive exponent to be 48. You cannot go beyond that. So, 48 plus 50, the biased value would give you an exponent value of 98. Now, if you need to represent an infinite number, you just have the exponent 99. What is the smallest value? It remains at minus 50. But let us suppose that you reserve the exponent value, the 2-digit exponent value 0 to represent the number 0. So, let us just summarize. The exponent value of 99 is used to represent the infinite number and the exponent value 0 is used to represent the actual value 0. Now, in order to do this, you need to decrease the range of exponent values which you can represent. So, as I have said before, the maximum exponent positive value would be 48 and the smallest negative exponent value would be minus 49. The other option to represent an infinite number and the number 0 is to reduce the biased value to 49. So, by reducing the biased value to 49, what is the largest exponent which we can represent? Well, it is not 48, but 49 because when you add the exponent 49 to the biased value 49, you get 98. You still have the number 99 or the exponent 99 to represent the value infinite. What is the smallest exponent value, the negative exponent value? Well, it has decreased to minus 48. So, minus 48 plus the biased value 49 would give you 1. That still leaves you with the exponent 0 to represent the number 0. Now, let us represent the decimal number 6918.3125 using the 32-bit single precision floating point format. Now, the decimal number 6918.3125 can be written in terms of binary as 1 1 0 1, 1 0 0 0, 0 0 1 1 0, 0.0101. The binary number has to be written in its normalized form. So, what is the normalized form of the binary number? It is 1.101, 0 0 0, 0 0, 1 1, 0 0, 1 0 1 into 2 power 12. What is the sign bet? Of course, the number is positive. So, the sign bet is 0. What is the exponent? The exponent is 12, 2 raise to power 12. The 32-bit single precision floating point format uses a biased 127 counting system. So, the exponent value 12 is added to 127, which results in 139. So, the 8-bit exponent field has the number 139, of course, represented in binary. What is the Mentessa part? The Mentessa part has the value 1 0, 1 1 0, 0 0 0, 0 1 1, 0 0 1, 0 1 0 and all the remaining bits are set to 0. The Mentessa part does not have the 1, which is immediately to the left of the decimal point. It is assumed that the 1 is there. So, it is considered to be a hidden 1. So, when the single precision format is converted back into binary format, the 1 is appended. Let us consider a few examples of floating point numbers. Consider the first example, positive 1.101 into 2 power 5. What is the sine bit? It is positive. The number is positive. What is the 8-bit exponent field? Well, the exponent is 5. Since we are using biased 127 number system, the exponent value is 5 plus 127, 132, 132, represented in binary, of course. What is the Mentessa part? Well, the number 1.101 into 2 power 5 is in its normalized form. So, we forget about the 1 immediately to the left of the decimal point. It is considered to be a hidden 1. So, the Mentessa part has the value 1 0, 1 and all the remaining bits are set to 0. Consider the second example. The number is minus 1.01011 into 2 power minus 126. What is the sine bit? The sine bit is 1 because the number is negative. What is the exponent value? Well, the exponent is negative 126. Since we are using biased 127 number system, you add the number 127 to minus 126. The result is 1. So, the exponent field has the value 1. What is the Mentessa part? Again, neglecting the hidden 1, which is immediately to the left of the decimal point, the Mentessa value is 01011. All the remaining bits are set to 0. Let us consider the third example. The number 0. How is it represented using the 32-bit floating point format? The sine is set to 0. It could also be set to 1. The exponent is all 0s. As we said, 0 value is represented by the exponent 0. The Mentessa field has all 0s. Let us consider how we represent the value in finite. The sine bit is set to 0. The exponent field is set to all 1s. In the 32-bit floating point binary representation, all 1s in the exponent field represent infinite and all 0s in the exponent field represent the number 0. The Mentessa has all 0 bits. Let us discuss the 32-bit floating point representation, which allows us to represent very large numbers, very small numbers and numbers which have an integer part and a fraction part. The previous three representations, the unsigned, the sine magnitude and the 2s complement only allowed us to represent small integer numbers, negative and positive. To represent even larger numbers or very small numbers, the 64-bit floating point double precision representation. To write very large binary numbers in the unsigned format, you would have a very long string of 1s and 0s. When you write such long strings, it is possible to make mistakes. How do you simplify writing long binary strings? Or how do you represent such long binary numbers or strings? Let us talk about hexadecimal numbers, which allow us to write such long binary strings in terms of short or small numbers. The hexadecimal number system is a base-16 number system. Since it is a base-16 number system, it has 16 different values. 0, 1, 2, 3 up to 9. Then the next six values are written as A, B, C, D, E and F. So, the hexadecimal number system has values ranging from the number 0 up to F. As I have said, the utility of the hexadecimal number system is to write long binary numbers in a concise or compact form. Let us see how we can count in hexadecimal number system. We can even add or perform other arithmetic operations with numbers written in the hexadecimal number system. So, let us have a look. The hexadecimal number system is a base-16 number system. It has 16 distinct values. The first 16 values in the hexadecimal number system are identical to the first 10 values in the decimal number system. So, they are 0 to 9. The remaining six values in the hexadecimal number system are A, B, C, D, E and F. Now, how do we count in hexadecimal number system? The value F represents the decimal number 15. So, how do we represent the decimal number 16? Well, in the hexadecimal number system, you have to use two digits to represent the number 16. The most significant digit is set to 1 and the least significant digit is set to 0. So, this combination of two digits with the most significant digit set to 1 and the least significant digit varying from 0 to F can count up to the number decimal 31. To count or to represent decimal number 32, the hexadecimal number used as 2, 0. So, for the next 16 decimal values starting from 32, the hexadecimal equivalent value would be a 2 digit number, the most significant digit being a 2 and the least significant digit varying from 0 to F. Binary numbers have to be converted into hexadecimal. As we have said, hexadecimal number system is used to represent long binary numbers in a compact and concise form. So, to convert from binary to hexadecimal, simply write the binary string, organize the string into groups of fours. So, considering the binary number 110, 101, 101, 011, 100, 101, 10, it is broken up into five groups of four binary bits. The conversion is very simple. Starting from the least significant group, simply write the hex number representing the four-bit binary number. So, 011, 0 is represented as 6 hexadecimal. The next group 1001, it is equivalent to 9 hexadecimal. Similarly, the third group 101, 1 is equivalent to B hexadecimal and so on. How do we convert from hexadecimal to binary? Well, consider the example of FD13, a hexadecimal number. Each hexadecimal number is represented by a group of four bits. So, starting from the least significant hexadecimal digit 3, its binary equivalent is 0011. The next hexadecimal digit 1, its binary equivalent is 0001. The third hexadecimal digit D has the binary equivalent of 1101 and the final hexadecimal digit F has the binary equivalent 1111. Now, if you combine all these eight bits, it gives the binary representation of the hexadecimal number FD13. We have just seen examples of counting in hexadecimal. We have also seen examples of converting from binary to hexadecimal and from hexadecimal to binary. The conversion from binary to hexadecimal and vice versa is very easy. We are also interested in converting from decimal to hexadecimal and from hexadecimal to decimal. So, what are the methods which are going to be used for converting between decimal and hexadecimal? So, how do you convert a number from any number system into decimal? Well, you use the sum of weights method. Similarly, when you are converting from hexadecimal to decimal, you would use the sum of weights method. You would write out an expression. The base value is 16. You can use an indirect method to convert from hexadecimal to decimal. The indirect method would be you first convert the hexadecimal number to binary and then from binary to decimal. Now, how would you convert from decimal to hexadecimal? Well, one of the methods which we can use is the indirect method. You first convert into binary and then from binary to hexadecimal. The other method is divide by 16 or the repeated division by 16. Now, in this method, you have a decimal number which you need to represent an hexadecimal. You divide the decimal number by 16. You get a quotient value and a remainder. So, you note down the remainder. You divide the quotient again by 16. You would get another quotient value and a remainder. So, you again store the remainder and you divide the quotient again by 16. You would end up with a quotient value of 0. This indicates that the conversion has been completed. So now, if you write out the remainder numbers which you had noted, that would give you the hexadecimal representation of the decimal number. Let us have a look at both these examples. Let us consider the example of converting hexadecimal to decimal using the sum of weights method. The number, the hexadecimal number CA02 is to be converted. An expression in terms of the base number 16 and weights is written. The expression is solved to give four sum terms. The most significant sum term is 49152. The second most significant sum term is 2560 and then the term 0 and the least significant sum term is 2. If you add all these terms, you end up with 51714. So, the decimal equivalent of CA02, the hexadecimal number is 51714. Now, consider the conversion of the decimal number into a hexadecimal number by using the repeated division by 16 method. The decimal number 2096 is divided by 16 to give you a quotient value of 131 and the remainder is 0. The quotient value 131 is again divided by 16 to give you another quotient value of 8 and the remainder 3. The remainder 3 is noted and the quotient value 8 is divided again by 16. The new quotient value is 0 and the remainder is 8. Since the quotient value is 0, that means the end of the conversion process. So, the hexadecimal equivalent of decimal 2096 is 830 hexadecimal. Let us consider adding hexadecimal numbers. Consider the two hexadecimal numbers 2AC6 and the number 92B5. Let us start by adding the two least significant hexadecimal digits 6 and 5. The result is 11 and decimal. How do you represent 11 and hexadecimal? It is equivalent to B. So, no carry is generated in this particular case. Let us add the two hexadecimal numbers C and B. C is equal to 12 and decimal and B is equal to 11 and decimal. So, the sum of C and B is equal to 23 and decimal. The hexadecimal equivalent of 23 is 17. So, basically it is a two digit number. The sum is 7 and the carry is 1. Now, adding the digit A and the digit 2 along with the carry generated from the previous two digits. The answer is 13 decimal. 13 decimal is represented in hexadecimal as D. No carry is of course generated. Finally, adding the most significant hexadecimal digits 2 and 9 results in 11 decimal, which is equivalent to B in hexadecimal. So, the answer is BD7B. Hexadecimal addition is similar to binary addition and decimal addition carries are generated. Let us subtract one hexadecimal number from another hexadecimal number. Let us consider the first hexadecimal number to be 9 to B5. And from this, we subtract 2AC6, the other hexadecimal number. Now, subtracting 6 from hexadecimal number 5 is not possible as 6 is larger than 5. So, what we do? We borrow a 1 from the next highest hexadecimal digit. Now, borrowing a 1 in hexadecimal number system means borrowing a 16. Borrowing a 1 in decimal number system means borrowing a 10. Borrowing a 1 in binary number system means borrowing a 2. So, now, if you borrow a 1, the result is 16 plus 5, which is 21. So, you subtract 6 from 21, which results in 15 decimal. 15 decimal is equal to F in hexadecimal. So, the answer of subtracting 6 from 5 results in F. Now, consider subtracting C from B. Remember, we had borrowed a 1 from B, so it has reduced to A. Now, C is larger than A. So, you have to borrow another 1 from the next higher digit. So, when you borrow a 1, 16 plus A becomes 26 in decimal. So, you are trying to subtract C, which is 12 from 26. The answer in decimal is 14. This is represented as E in hexadecimal. Let us turn to the subtraction of A from 2 hexadecimal. Now, since we had borrowed a 1, the 2 is now equal to 1. So, again, A is greater than 1. So, you have to borrow another 1 from the most significant digit. So, now, you are subtracting A, which is 10 from 17. The answer is 7 decimal, which is also equal to 7 hexadecimal. Finally, subtracting 2 from 8 because a 1 had been borrowed, the answer is 6. So, the answer of subtracting 2AC6 hexadecimal from 9 to B5 hexadecimal is 67EF hexadecimal. We just saw examples of converting from decimal to hexadecimal from hexadecimal to decimal and examples of adding numbers represented in hexadecimal and subtracting numbers represented in hexadecimal. We stop for today. We would be continuing with the octal number system in the next lecture. Hope to see you again. Keep revising the exercises and the examples mentioned in the book. God Hafiz and As-Salaamu Alaikum.