Hexadecimal Arithmetic

Though the computers store everything in binary format, the user interface deals with the hexadecimal format for ease of understanding. For a human, it is easy to deal with hexadecimal than the stream of ones and zeros. So, in this article, we will study the arithmetic of hexadecimal numbers.

One way to perform hexadecimal arithmetic is to convert the hexadecimal numbers to binary numbers, then, using the rules of binary arithmetic perform the binary operations, and finally convert the binary result back to hexadecimal form. Another way is to directly perform the operation on the hexadecimal numbers.

Hexadecimal arithmetic is pretty similar to decimal arithmetic. The only difference is that decimal deals with 10 numbers (0 to 9), whereas hexadecimal deals with 16 numbers (0 to 9 and A, B, C, D, E, F). So in the case of hexadecimal, carry gets generated at 16, and not at 10. Let’s solve a few examples to get used to with hexadecimal arithmetic.

Hexadecimal Addition

Example: (9B3 + 68)16 = ?16

Example of Hexadecimal Addition

(9B3 + 68)16 = A1B16

The LSB place addition generates (3 + 8 =) 11. In hexadecimal “11” is ‘B’. The next place addition is B + 6 = 11 + 6 = 17. Here, the carry is generated when the sum reaches 16 or beyond. So, after the carry is generated, the remaining value is 1 (17 – 16 = 1). The MSB place has 9 and a carry. So, it will generate 9 + 1 = 10, which is ‘A’ in hexadecimal. Thus, the generated Sum is A1B16.

Hexadecimal Subtraction

Example: (9B3 – 68)16 = ?16

Example of Hexadecimal Subtraction

At the LSB place subtraction, 3 is less than 8. So, it borrows 1 from the next place. Now, the Borrow 1 at LSB place would have the value of 16. So, the LSB place subtraction would generate 16 + 3 – 8 = 11. In hexadecimal “11” is ‘B’. In the next place, after the borrow by the LSB, B – 1 = A is remaining. So, the subtraction is A – 6 = 10 – 6 = 4. The MSB place has 9. Thus, the generated result is 94B16.

Previous           Table of Content           Next

Leave a Reply

Your email address will not be published. Required fields are marked *