Number Systems
We saw previously that a computer stores data internally in a format that human beings cannot read
easily. This is the reason why computer systems require input and output (I/O) interfaces. Every
computer store numbers, letters, and other special characters in coded form.
NON-POSITIONAL NUMBER SYSTEMS
Characteristics
Use symbols such as I for 1, II for 2, III for 3, IIII for 4, IIIII for 5, etc
Each symbol represents the same value regardless of its position in the number
The symbols are simply added to find out the value of a particular number
Difficulty
It is difficult to perform arithmetic with such a number system
POSITIONAL NUMBER SYSTEMS
In a positional number system, there are only a few symbols called digits. These symbols represent
different values, depending on the position they occupy in a number. The following three
considerations determine the value of each digit in such a number:
1. The digit itself,
2. The position of the digit in the number, and
3. The base of the number system.
(base = total number of digits in the number system)
The maximum value of a single digit is always equal to one less than the value of the base
Decimal Number System
Characteristics
• A positional number system
• Has 10 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9). Hence, its base = 10
• The maximum value of a single digit is 9 (one less than the value of the base)
• Each position of a digit represents a specific power of the base (10)
• We use this number system in our day-to-day life
258610= (2 x 103) + (5 x 102) + (8 x 101) + (6 x 100) = 2000 + 500 + 80 +6
Hence, we can represent any number by using the available digits and arranging them in various
positions(weights).
The principles that apply to decimal number system, also apply to any other positional number system.
It is important to keep track of only the base of the number system in which we are working.
Binary Number System
Characteristics
• A positional number system
• Has only 2 symbols or digits (0 and 1). Hence its base = 2
• The maximum value of a single digit is 1 (one less than the value of the base)
• Each position of a digit represents a specific power of the base (2)
• This number system is used in computers
Example
101012 = (1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) x (1 x 20)
= 16 +0+4+0+1
= 2110
Representing Numbers in Different Number Systems
In order to be specific about which number system we are referring to, it is a common practice to
indicate the base as a subscript. Thus, we write:
101012 = 2110
Bit
• Bit stands for binary digit
• A bit in computer terminology means either a 0 or a 1
• A binary number consisting of n bits is called an n-bit number
Octal Number System
Characteristics
• A positional number system
• Has total 8 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7). Hence, its base = 8
• The maximum value of a single digit is 7 (one less than the value of the base
• Each position of a digit represents a specific power of the base (8)
Since there are only 8 digits, 3 bits (23 = 8) are sufficient to represent any octal number in binary
Example
20578 = (2 x 83) + (0 x 82) + (5 x 81) + (7 x 80)
= 1024 + 0 +40 +7
= 107110
Hexadecimal Number System
Characteristics
• A positional number system
• Has total 16 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F). Hence its base = 16
• The symbols A, B, C, D, E and F represent the decimal values 10, 11, 12, 13, 14 and 15
respectively
• The maximum value of a single digit is 15 (one less than the value of the base)
Each position of a digit represents a specific power of the base (16)
Since there are only 16 digits, 4 bits (24 = 16) are sufficient to represent any hexadecimal number
in binary
Example
1AF16 = (1 x 162) + (A x 161) + (F x 160)
= 1 x 256 + 10 x 16 + 15 x 1
= 256 + 160 + 15
= 43110
Converting a Number of Another Base to a Decimal Number
Method
Step 1: Determine the column (positional) value of each digit
Step 2: Multiply the obtained column values by the digits in the corresponding columns
Step 3: Calculate the sum of these products
Converting a Decimal Number to a Number of Another Base
Division-Remainder Method
Step 1: Divide the decimal number to be converted by the value of the new base
Step 2: Record the remainder from Step 1 as the rightmost digit (least significant digit) of the new
base number
Step 3: Divide the quotient of the previous divide by the new base
Step 4: Record the remainder from Step 3 as the next digit (to the left) of the new base number
Repeat Steps 3 and 4, recording remainders from right to left, until the quotient becomes zero in Step
3
Note that the last remainder thus obtained will be the most significant digit (MSD) of the new base
number
Converting from a Base Other Than 10 to Another Base Other Than 10
Method
Step 1: Convert the original number to a decimal number (base 10)
Step 2: Convert the decimal number so obtained to the new base number
WHY BINARY?
'Why are binary numbers used instead of decimal numbers?' The reasons are as follows:
1. Information is handled by computer's electronic/electrical components such as transistors,
semiconductors, wires, etc., and all these can indicate only two states or conditions - ON (state 1) or
OFF (state 0). Transistors are either conducting (state 1) or non-conducting (state 0), magnetic
materials are either magnetized (state 1) in one or opposite direction or non-magnetized (state 0), a
pulse or voltage is present (state 1) or absent (state 0) in wire. Information is represented within a
computer by the presence or absence of these types of signals. Binary number system having only two
digits (0 and 1) is most suitable for expressing the two possible states. Figure 5.1 illustrates the concept
of binary components.
2. By using binary numbers, computer circuits only have to handle two binary digits rather than ten
decimal digits. This greatly simplifies the internal circuit design of computers resulting in less expensive
and more reliable circuits.
3. Finally, all possible operations in decimal number system are also possible in binary number system.
Computer Arithmetic
Binary Addition
Rule for binary addition is as follows:
0 +0=0
0 +1=1
1 +0=1
1 + 1 = 0 plus a carry of 1 to next higher column
Binary Subtraction
Rule for binary subtraction is as follows:
0- 0 =0
0- 1 =1with a borrow from the next column
1- 0 =1
1- 1 =0
Assignment for further reading. Read on additive method of binary subtraction.
Binary Division
Rules for Binary Division
1. Start from the left of the dividend
2. Perform a series of subtractions in which the divisor is subtracted from the dividend
3. If subtraction is possible, put a 1 in the quotient and subtract the divisor from the
corresponding digits of dividend
4. If subtraction is not possible (divisor greater than remainder), record a 0 in the quotient
5. Bring down the next digit to add to the remainder digits. Proceed as before in a manner
similar to long division