Number Systems
A number system with base, or radix, is a system that uses distinct symbols for digits. Numbers in this system are represented by a string of these digit symbols. To determine the quantity that a number represents, each digit is multiplied by an integer power of and then summed up.
Decimal Number System (Base 10)
The decimal number system, which we use in everyday life, employs the radix 10 system. The 10 symbols used are:
For example, the number 724.5 in decimal notation is interpreted as:
This means:
- represents 7 hundreds
- represents 2 tens
- represents 4 units
- represents 5 tenths
Binary Number System (Base 2)
The binary number system uses radix 2. It employs the two symbols:
For example, the binary number 101101 is interpreted as:
To distinguish between numbers of different bases, we enclose the digits in parentheses and place the radix as a subscript. For example, to denote the equivalence between decimal and binary representations of forty-five, we write:
Octal and Hexadecimal Number Systems
Besides the decimal and binary systems, the octal (radix 8) and hexadecimal (radix 16) systems are significant in digital computing.
Octal Number System (Base 8)
The octal system uses eight symbols:
For example, the octal number 736.4 is converted to decimal as follows:
Hexadecimal Number System (Base 16)
The hexadecimal system uses sixteen symbols:
Here, the symbols A, B, C, D, E, and F correspond to decimal numbers 10, 11, 12, 13, 14, and 15 respectively. For example, the hexadecimal number F3 is converted to decimal as follows:
Conversion from Decimal to Other Bases
To convert a number from decimal to another base :
- Separate the number into its integer and fractional parts.
- Convert the integer part by successive divisions by , collecting the remainders.
- Convert the fractional part by successive multiplications by , collecting the integer parts of the results.
Example: Decimal to Binary Conversion
Convert the decimal number 41.6875 to binary.
Integer Part
- Divide 41 by 2:
The binary representation of 41 is obtained from the remainders read bottom-up:
Fractional Part
- Multiply 0.6875 by 2:
The binary representation of 0.6875 is obtained from the integer parts:
Combining both parts, the binary representation of 41.6875 is:
Conversion Between Binary, Octal, and Hexadecimal
Conversion between binary, octal, and hexadecimal systems is straightforward due to their bases being powers of 2.
Binary to Octal Conversion
Each octal digit corresponds to three binary digits since .
Binary to Hexadecimal Conversion
Each hexadecimal digit corresponds to four binary digits since .
Example: Binary to Octal and Hexadecimal Conversion
Consider a 16-bit binary number:
Binary to Octal
Partition into groups of three bits starting from the right:
This gives the octal representation:
Binary to Hexadecimal
Partition into groups of four bits starting from the right:
This gives the hexadecimal representation:
Binary-Coded Decimal (BCD)
A binary code that represents each decimal digit using a fixed number of binary digits (typically four) is called Binary-Coded Decimal (BCD).
Example: BCD Representation
For example, the decimal number 99 in BCD is:
Alphanumeric Representation
In many computer applications, data includes not only numbers but also letters and special characters.
ASCII Code
The standard alphanumeric binary code is ASCII (American Standard Code for Information Interchange), which uses seven bits to code 128 characters. For example, the binary codes for the uppercase letters A to Z and the digits 0 to 9 are:
Character | Binary Code | Character | Binary Code |
---|---|---|---|
A | 100 0001 | 0 | 011 0000 |
B | 100 0010 | 1 | 011 0001 |
C | 100 0011 | 2 | 011 0010 |
D | 100 0100 | 3 | 011 0011 |
E | 100 0101 | 4 | 011 0100 |
F | 100 0110 | 5 | 011 0101 |
G | 100 0111 | 6 | 011 0110 |
H | 100 1000 | 7 | 011 0111 |
I | 100 1001 | 8 | 011 1000 |
J | 100 1010 | 9 | 011 1001 |
K | 100 1011 | space | 010 0000 |
L | 100 1100 | . | 010 1110 |
M | 100 1101 | ( | 010 1000 |
N | 100 1110 | + | 010 1011 |
O | 100 1111 | $ | 010 0100 |
P | 101 0000 | * | 010 1010 |
Q | 101 0001 | ) | 010 1001 |
R | 101 0010 | - | 010 1101 |
S | 101 0011 | / | 010 1111 |
T | 101 0100 | , | 010 1100 |
U | 101 0101 | = | 011 1101 |
V | 101 0110 | ||
W | 101 0111 | ||
X | 101 1000 | ||
Y | 101 1001 | ||
Z | 101 1010 |
Binary codes are crucial for representing data in digital systems, enabling efficient processing and storage of diverse information types.