Computer architecture supports following number systems.
- Binary Number System
- Decimal Number System
- Octal Number System
- Hexadecimal Number System
Binary Number System
A Binary number system has only two digits that are 0 and 1. Every number (value) represents with 0 and 1 in this number system. The base of binary number system is 2, because it has only two digits.
Binary system was introduced by Gottfried wilhelm leibniz.
Example:
1 in binary system is represented as 0001
3 in binary system is represented as 0011
[latex](1001)_{2}[/latex] = [latex]1 * 2^3[/latex] + [latex]0 * 2^2[/latex] + [latex]0 * 2^1[/latex] + [latex]1 * 2^0[/latex]
i.e.8 + 0 + 0 + 1 = 9
One bit is 0 or 1, 4 bits are equal to one nibble and 8 bits is known as one Byte. A single "word" may consist 16 or 32 bits in size. Floating point arithmetic is used to represent real numbers, fractions and large numbers.
Name |
Size |
1 bit |
Single digit 0 or 1 |
1 nibble |
4 bits |
1 byte |
8 bits |
1 Kilobyte(KB) |
1024 Bytes |
1 Megabyte(MB) |
1024 KB |
1 Gigabyte(GB) |
1,024 MB |
1 Terabyte(TB) |
1,024 GB |
1 Petabyte (PB) |
1,024 TB |
1 Exabyte (EB) |
1,024 PB |
Decimal Number System
Decimal Number System is a general number system that consists ten digits from 0 to 9. Any numeric value can be represented by using these numbers. It is also called as base-10 or positional number system.
Example:
[latex]3 * 10^2[/latex] + [latex]5 * 10^1[/latex] + [latex]6 * 2^0[/latex] = [latex](356)_{10}[/latex]
Octal Number System
Octal Number system is also known as Base 8 system and consists 8 digits from 0 to 7. It is represented in the power of 8. It is a shorter number System.
Example:
[latex](21)_{8}[/latex] = [latex]2 * 8^1[/latex] + [latex]1 * 8^0[/latex] = 16 + 1 = 17
Representation of Octal Numbers in Binary:
Octal |
Binary Digits |
0 |
000 |
1 |
001 |
2 |
010 |
3 |
011 |
4 |
100 |
5 |
101 |
6 |
110 |
7 |
111 |
Hexadecimal Number System
It is a shorthand method of working with binary numbers. It is also called as a base -16 system or Hex. This system consists of 16 digits from 0 to 9 and A to F. A denotes 10, B denotes 11, C denotes 12, D denotes 13, E denotes 14 and f denote 15. It is represented in the power of 16.
Example:
[latex](21)_{16}[/latex] = 21H = [latex]2 * 16^1[/latex] + [latex]1 * 16^0[/latex] = 2 × 16 + 1 = 33
Representation of Hexadecimal Number:
Octal |
Hexadecimal |
Binary Digits |
0 |
0 |
0000 |
1 |
1 |
0001 |
2 |
2 |
0010 |
3 |
3 |
0011 |
4 |
4 |
0100 |
5 |
5 |
0101 |
6 |
6 |
0110 |
7 |
7 |
0111 |
8 |
8 |
1000 |
9 |
9 |
1001 |
10 |
A |
1010 |
11 |
B |
1011 |
12 |
C |
1100 |
13 |
D |
1101 |
14 |
E |
1110 |
15 |
F |
1111 |
Conversion between the Number systems
Decimal to Binary:
1. Divide the given decimal number by 2.
2. The remainder should be 0 or 1, note the quotient and remainder.
3. If the quotient is not 0, then again divide by 2 until the quotient=0 and then stop the process.
4. The first remainder is called as Least Significant bit and the last remainder is known as the Most Significant bit.
5. The remainders will be arranged from last remainder bit to the first remainder bit.
Example: [latex](56)_{10}[/latex] =
|
|
Remainder |
2 |
56 |
|
2 |
28 |
0 → LSD |
2 |
14 |
0 |
2 |
7 |
0 |
2 |
3 |
1 |
|
1 |
1 → MSB |
Binary to Decimal
1. In this, multiply binary digit with the powers of 2.
2. For an integral part, the power will be positive and negative for the fractional part.
3. Finally, add those multiplying digits.
Example: [latex](1110.10)_{2}[/latex] = ?
[latex]1 * 2^3[/latex] + [latex]1 * 2^2[/latex] + [latex]1 * 2^1[/latex] + [latex]1 * 2^0[/latex] + [latex]1 * 2^{-1}[/latex] + [latex]0 * 2^{-2}[/latex]
= 8 + 4 + 2 + 0 + 0.5 + 0 = [latex](14.5)_{10}[/latex]
Binary to Octal
1. Separate the given number into a group of three bits from right to left
2. Convert each group to a decimal number.
Example: [latex](110010)_{2}[/latex] = ?
= (110)(010)
= (6)(2) = [latex]62_{8}[/latex]
Octal to Binary
1.This is completely opposite to binary to octal.
2. Convert every digit of the number from octal to binary in the group of three bits.
Example: [latex](534.2)_{8}[/latex] = ?
= 5 → 101 3 → 011 4 → 100 2 → 010
= [latex](101011100.010)_{2}[/latex]
Binary to Hexadecimal
1.In this, the binary code will be split into four-bit group from right to left.
2. Then each group will be converted into decimal numbers.
Example: [latex](10100011)){2}[/latex] = ?
= 1010 → A 0011 → 3
= [latex](A3)_{16}[/latex]
Hexadecimal to Binary
Conversion of hexadecimal digital to binary digit.
Example: [latex](AF62)_{16}[/latex] = ?
= A → 1010 F → 1111
6 → 0110 2 → 0010
= [latex](1010111101100010)_{2}[/latex]
Decimal to octal
1. The given number is divided by 8.
2. The remainder will be 0 to 7. Note the quotient and remainder.
3. This process will be running until the quotient=0.
4. Note the each remainder from left to right.
Example: [latex](65621)_{10}[/latex] = ?
|
|
Remainder |
8 |
65621 |
5 → LSD |
8 |
8202 |
2 |
8 |
1025 |
1 |
8 |
128 |
0 |
8 |
16 |
0 |
8 |
2 |
2 → MSB |
[latex](65621)_{10}[/latex] = [latex](200125)_{8}[/latex]
Octal to Decimal
1. Multiply the given number with the power of 8.
2. For an integral part, the power will be positive and negative for the fractional part.
3. Add all multiple digits.
Example: [latex]653_{8}[/latex] = ?
= [latex]6 * 8^2[/latex] + [latex]5 * 8^1[/latex] + [latex]3 * 8^0[/latex]
= 384 + 40 + 3 = [latex](427)_{10}[/latex]
Decimal to Hexadecimal
1.The given number should be divided by 16
2. The digits of remainders will be 0 to 9 and A to F
3. The process of division should be run until the quotient=0 or less than 16.
4. Each remainder can be written from left to right.
Example: [latex](943562)_{10}[/latex] = ?
|
|
Remainder |
16 |
943562 |
A → LSD |
16 |
58972 |
C |
16 |
3685 |
5 |
16 |
230 |
6 |
16 |
14 |
E → MSD |
= [latex](943562)_{10}[/latex] = [latex](E65CA)_{16}[/latex]
Hexadecimal to Decimal
1. Multiply each digit with the power of 16.
2. The power should be positive for an integral part.
3. Add all the multiplying digits.
Example: [latex](AE12C)_{16}[/latex] = ?
= [latex]10 * 16^4[/latex] + [latex]14 * 16^3[/latex] + [latex]1 * 16^2[/latex] + [latex]2 * 16^1[/latex] + [latex]12 * 16^0[/latex]
= [latex](71004)_{10}[/latex]
Octal to Hexadecimal
1.The conversion of octal to hexadecimal is not possible directly, so first convert each digit of octal number to binary.
2. Again convert it into hexadecimal from right to left.
Example: [latex](76224)_{8}[/latex]=?
7 → 111 6 → 110
2 → 010 4 → 100
=[latex](111110010010100)_{2}[/latex]
=0111 → 7 1100 → C 1001 → 9 0100 → 4
=[latex](7C94)_{16}[/latex]
Hexadecimal to Octal
1. First, the given number should be converted into binary system.
2. Again the binary digits will be converted into octal numbers right to left.
Example: [latex](96AF8)_{16}[/latex]=?
= 9 → 1001 6 → 0110 A → 1010 F → 1111 8 → 1000
=[latex](10010110101011111000)_{2}[/latex]
= 010 → 2 010 → 2 110 → 6 101 → 5 011 → 3 111 → 7 000 → 0
=[latex](2265370)_{8}[/latex]
Computer codes
In computers, the alphabets, numbers, and special characters are represented in binary code only.
- There are two important codes in computer awareness such as BCD and ASCII.
- BCD stands for Binary Coded Decimal. It represents four digits and is developed by IBM Corporation.
- This method is used to represent binary digits as decimal digits. This system doesn't have any limit on the size of a number.
- ASCII: American Standard Code for Information Interchange is represented by 7 bits. It explains 128 character codes from 0 to 127.