Numbering systems
Decimal: {0, 1, 2, 3, 4, 5…}
Binary: {0, 1}
Octal: {0, 1, 2, 3, 4, 5, 6, 7}
Hexadecimal: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
Conversion methods
- From decimal to binary (divide the decimal number by 2 then take the remainder –up right-to be the binary representation of the original number)
Example: (13)10 à(----)2
Original # | division | Remainder |
13 | 2 | 1 |
6 | 2 | 0 |
3 | 2 | |
1 | 2 | 1 |
0 | | |
So the result will be (1101) 2
- From binary to decimal: multiply each digit with 2 to the power of (0 to 7) in its order from right to left then sum the final result
Example: (1101)2à (….)10
Original # | 1 | 1 | 0 | 1 |
Multiplication | 1*23 | 1* 22 | 0*21 | 1* 20 |
Result for each digit | 8 | 4 | 0 | 1 |
addition | 13 |
So the result will be (13)10
Special case: fraction:
Example: (1101.10)2à (….)10
Original # | 1 | 1 | 0 | 1 | . | 1 | 0 |
| |
multiplication | 1*23 | 1* 22 | 0*21 | 1* 20 | . | 1*2-1 | 0*2-2 |
| |
Result for each digit | 8 | 4 | 0 | 1 | | .5 | 0 | ||
addition | 13 | . | .50 | ||||||
So the result will be (13.5)10
- From binary to octal: each 3 binary digits represents 1 octal digit
Octal= 23 binary
Example: (1011101) 2à (…) 8
Original # | 1011101 | ||
Divide to 3 digits | 001 | 011 | 101 |
Convert to decimal | 1 | 3 | 5 |
Concatenate (result) | 135 |
The result will be (135) 8
- From octal to binary: convert each octal digit to its binary representation then concatenate the result
Example: (357) 8 à (…….)2
Original # | 357 | ||
For each octal digit | 3 | 5 | 7 |
Convert to binary | 011 | 101 | 111 |
Concatenate (result) | 011101111 |
The result will be (011101111)2
- From binary to Hexadecimal: each 4 binary digits represents 1 hexadecimal digit
Hexadecimal= 24 binary
Example: (1011101) 2à (…) 16
Original # | 1011101 | |
Divide to groups of 4 digits | 0101 | 1101 |
Convert to decimal | 5 | 13 |
Convert to hexadecimal | 5 | D |
Concatenate (result) | 5D |
The result will be (5D) 16
- From Hexadecimal to binary: convert each hexadecimal digit to its binary representation then concatenate the result
Example: (D7B) 16 à (…….)2
Original # | D7B | ||
Convert each hexadecimal digit to binary | 1101 | 0111 | 1011 |
Concatenate (result) | 110101111011 |
The result will be (110101111011)2
- From any numbering system to decimal: multiply each digit by the target system base to the power of (0 to 7) in its order from right to left then sum the final result
Example: (247)8à (….)10
Original # | 2 | 4 | 7 |
|
The digit multiplied by the Base to the power from 0-7 from R to L | 2* 82 | 4*81 | 7* 80 |
|
Result for each digit | 128 | 32 | 7 |
|
addition | 167 |
So the result will be (167)10
- From decimal to any numbering system: (divide the decimal number by the base of the target system then take the remainder –up right-to be the new representation of the original number)
Example: (4037)10 à(----)16
Original # | division | Remainder |
4037 | 16 | |
252 | 16 | 12àC |
15 | 16 | 15àF |
0 | | |
So the result will be (FC5) 16