Number Systems
INTRODUCTION
A number base is a system used for counting and writing numbers. Different
number bases use different digits and place values. In everyday life, we mostly use
base 10, but computers use base 2. Understanding number bases helps us know
how numbers work in mathematics and technology.
6.1 Decimal System
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 [Link] 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.
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 [Link] 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.
If there is a remainder, it is placed in the
LSB of the binary number. If there is no
remainder, a 0 is placed in the LSB. The
result of the division is brought down
and the process is repeated until the
result of successive divisions has been
reduced to 0.
6.6 Binary Arithmetic
Mathematical operations include addition, subtraction, multiplication, and division. Binary addition
follows rules similar to decimal addition. When adding with binary numbers, there are only four
conditions that can occur:
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:
To subtract from larger binary numbers, subtract column
by column, borrowing from the adjacent column when
necessary. Remember that when borrowing from the
adjacent column, there are now two digits, i.e., 0 borrow
1 gives 10.
Binary numbers can also be negative. The procedure
for this calculation is identical to that of decimal
numbers because the smaller value is subtracted
from the larger value and a negative sign is placed in
front of the result.
There are other methods available for doing subtraction:
1’s complement
2’s complement
The procedure for subtracting numbers using the 1’s complement is as follows:
Step 1 Change the subtrahend to 1’s complement.
Step 2 Add the two numbers.
Step 3 Remove the last carry and add it to the number (end-around carry)
When there is a carry at the end of the
result, the result is positive.
When there is no carry, we take the 1’s
complement of the result is and a minus
sign has to be placed in front of it.
For subtraction using the 2’s complement, the
2’s complement is added instead of subtracting
the numbers. In the result, if the carry is a 1,
then the result is positive; if the carry is a 0,
then the result is negative and requires
a minus sign.