CHAPTER 1 : NUMBER SYSTEM
1.5 : Hexadecimal Number Operation
by : Muhammad Azmil Bin Ariffin B031210006
by : Muhammad Azmil Bin Ariffin B031210006
Hexadecimal Addition
Hexadecimal basic concepts:
Hexadecimal basic concepts:
- Hexadecimal is base 16.
- There are 16 digits in counting (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F)
- When you reach 16, you carry a “1” over to the next column
- The number after F (decimal 15) is 10 in hex (or 16 in decimal)
Use the following steps to perform hexadecimal
addition:
1. Add one column at a time.
2. Convert to decimal and add the
numbers.
3a. If the result of step two is 16 or larger
subtract the result from 16 and carry 1 to the
next column.
3b. If the result of step two is less than
16, convert the number to hexadecimal.
Example : 5816 + 2216 A = 10
5 816 B = 11
2 216 C = 12
-------------- D = 13
5 816 B = 11
2 216 C = 12
-------------- D = 13
7 1016 ----->7A16 E = 14
F = 15
2B16 + 8416 C = 12
2 B16 D = 13
In example, shows the subtraction of hexadecimal number operation. Firstly, we have to convert the hexadecimal number to binary. Then, take the 2's complement of the binary number and change it back to hexadecimal number. Add both numbers to get the result.
1B 816
F = 15
2B16 + 8416 C = 12
2 B16 D = 13
8 416 E = 14
------------------ F = 15
10 1516 ----->AF16
Hexadecimal Subtraction
Example:
Example:
In example, shows the subtraction of hexadecimal number operation. Firstly, we have to convert the hexadecimal number to binary. Then, take the 2's complement of the binary number and change it back to hexadecimal number. Add both numbers to get the result.
8416 - 2A16
2A16 = 001010102
2A16 = 001010102
2's complement of 2A16 = 0101010 ----> 11010101
+ 1
------------------------------
11010110 = +D610
11010110 = +D610
8 416 Add
+ D 616
-------------------
15 A16
-------------------
C316 - 0B16
0B16 = 000010112
2's complement of 0B16 = 11110101 = F516
0B16 = 000010112
2's complement of 0B16 = 11110101 = F516
C 316
+ F 516
-------------------
A8316 - 43B16
A 87 31316
+ 4 3 B16
------------------------
6 4 816
No comments:
Post a Comment