Lec2_NumberSystem
Lec2_NumberSystem
Some slides were adapted/taken from various internet sources. We thankfully acknowledge them. Students are requested to
use this material for their study only and NOT to distribute it.
Number Systems
After completing this chapter, you will be able to:
• Define the decimal, binary, octal, and hexadecimal numbering systems and be
able to convert from one numbering or coding system to another
• Define the terms bit, byte, word, least significant bit (LSB), and most significant
bit (MSB) as they apply to binary memory locations
• Add, subtract, multiply, and divide binary number
6.1 Decimal System
Knowledge of different number systems and digital codes is quite useful when working with
almost any type of digital computer. This is true because a basic requirement of these devices is
to represent, store, and operate on numbers. In general, computer work on binary numbers in
one form or another; these are used to represent various codes or quantities.
The decimal system, which is most common to us, has a base of 10. The radix or base of a
number system determines the total number of different symbols or digits used by that system.
For instance, in the decimal system, 10 unique numbers or digits—i.e., the digits 0 through 9—
are used: the total number of symbols is the same as the base, and the symbol with the largest
value is 1 less than the base.
The value of a decimal number depends on the digits that make up the number and the place value
of each digit. A place (weight) value is assigned to each position that a digit would hold from right
to left. In the decimal system the first position, starting from the rightmost position, is 0; the
second is 1; the third is 2; and so on up to the last position. The weighted value of each position
can be expressed as the base (10 in this case) raised to the power of the position.For the decimal
system then, the position weights are 1, 10, 100, 1000, and so on. Figure 6.1 illustrates how the
value of a decimal number can be calculated by multiplying each digit by the weight of its position
and summing the results.
6.2 Binary System
The binary system uses the number 2 as the base. The only allowable digits are 0 and 1. With digital
circuits it is easy to distinguish between two voltage levels (i.e., +5 V and 0 V), which can be related
to the binary digits 1 and 0 (Figure 6.2). Therefore, the binary system can be applied quite easily to
computer systems. Since the binary system uses only two digits, each position of a binary
number can go through only two changes, and then a 1 is carried to the immediate left
position.
Table 6.1 shows a comparison among four common number systems: decimal (base 10), octal (base 8),
hexadecimal (base 16), and binary (base 2). Note that all numbering systems start at zero.
The decimal equivalent of a binary number
can be determined in a manner similar to
that used for a decimal number. This time
the weighted values of the positions are 1,
2, 4, 8, 16, 32, 64, and so on. The weighted
value, instead of being 10 raised to the
power of the position, is 2 raised to the
power of the position.
Figure 6.3 illustrates how the binary number 10101101 is converted to its decimal equivalent:
173.
Each digit of a binary number is known as a bit. In a
processor-memory element consists of hundreds or
thousands of locations. These locations, or registers,
are referred to as words. Each word is capable of
storing data in the form of binary digits, or bits.
Bits can also be grouped within a word into bytes.
A group of 8 bits is a byte, and a group of 2 or
more bytes is a word.Figure 6.4 illustrates a 16-bit
word made up of 2 bytes. The least significant bit
(LSB) is the digit that represents the smallest
value, and the most significant bit (MSB) is the
digit that represents the largest value. A bit within
the word can exist only in two states: a logical 1
(or ON) condition, or a logical 0 (or OFF) condition.
To convert a decimal number to its binary equivalent, we must perform a series of divisions by 2.
Figure 5.5 illustrates the conversion of the decimal number 47 to binary. We start by dividing the
decimal number by 2.
The first three conditions are easy because they are like adding decimals, but the last condition is
slightly different. In decimal, 1 + 1 = 2. In binary, a 2 is written 10. Therefore, in binary, 1 + 1 = 0,
with a carry of 1 to the next most significant place value. When adding larger binary numbers,
the resulting 1s are carried into higher-order columns, as shown in the following examples.
In arithmetic functions, the initial numeric quantities
that are to be combined by subtraction are the minuend
and subtrahend. The result of the subtraction process is
called the difference, represented as:
5. Convert each of the following hexadecimal numbers to 6. Convert each of the following hexadecimal numbers to
decimal numbers: binary numbers:
a. 5A a. 4C
b. C7 b. E8
c. 9B5 c. 6D2
d. 1A6 d. 31B
7. Add the following binary numbers: 10. Express the decimal number 18 in each of the
following number codes:
a. 110 + 111 a. Binary
b. 101 + 011 b. Octal
c. Hexadecimal
c. 1100 + 1011
8. Subtract the following binary numbers:
a. 1101 − 101
b. 1001 − 110
c. 10111 − 10010