Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Computation of Number System

INTRODUCTION
There is centuries of mental eort and sheer good
luck which had gone into the development of the
number system we use. Our present number sys-
tem provides modern mathematicians and scien-
tists with a great advantage over those of pre-
vious civilizations and is an important factor in
our rapid advancement. Since hands are the most
convenient tools nature has provided, human be-
ings have always tended to use them in counting.
so the decimal number system followed naturally
from this usage.

To a computer everything is a number, e.g. let-


ters, punctuation marks, sounds, and pictures.
Even the computer's own instructions are num-
bers. The decimal number system (deci
means 10 in Latin) is called base 10 because
10 symbols are available, i.e. 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, which are called Arabic numerals. To
represent a number greater than 9, two symbols
are used, e.g. 9+1=10. Each symbol in a number
is called a digit, so 10 is a two digit number. Af-
ter using all the possible two digit pairings, three
Figure 1: The decimal number system.
digit pairing is started and the process continues
indenitely

As the number starts to become longer, the


concept of place becomes important. Consider
the number 2,657. Four places are represented in
this number: the thousands, hundreds, tens, and
ones. Thus, there is a 2 in the thousands place,
a 6 in the hundreds place, a 5 in the tens place,
and a 7 in the ones place. Figure 1 illustrate the
value of place.

In a computer all data is represented by the Figure 2: On and O switch.

state of the electronic switches. A switch has


only two possible states, i.e. on and o, so it can

1
Figure 4: Power of 2.

28 = 256 as illustrated in Figure 4. So with one


byte, the computer can represent one of 256 dif-
ferent symbols or characters because the eight 1s
and 0s in a byte can be combined in 256 dier-
ent ways. The byte is an important unit because
Figure 3: Counting in base 10 and base 2. there are enough dierent eight-bit combinations
to represent all the characters on a keyboard, in-
cluding all the letters (uppercase and lowercase),
represent only two numeric values as illustrated
numbers, punctuation marks, and other symbols.
in Figure 2. To a computer when the switch is
The principal circuit elements in modern com-
o, it represents a 0; when a switch is on, it rep-
puters are transistors, instead of switches and re-
resents a 1. Because there are only two values so
lays. The desire for reliability led designers to
computers are said to function in base 2, which
use these devices so that they were always in one
is also known as binary number system (bi
of the two states (i.e. on or o ), fully conduct-
means two in Latin). When a computer needs
ing or nonconducting. A simple analogy may be
to represent a quantity greater than one, it does
made between this type of circuit and an electric
the same thing as we do in the decimal system
light. At any given time the light (or transistor)
when representing a quantity greater than 9: it
is either on (conducting) or o (not conducting).
uses two (or more) digits. Figure 3 illustrate the
Even after a bulb is old and weak, it is generally
comparison between binary and decimal number
easy to tell whether it is on or o. Because of
systems.
the large number of electronic parts used in com-
puters, it is highly desirable to utilize them in
Bits and Bytes such a manner that slight changes in their char-
acteristics will not aect their performance. The
When referring to computerized data, the value
best way to accomplish this is to use use circuits
represented by each state of the switch is called
a bit. A bit is the smallest possible unit of data
which are basically bistable (having two possible
states).
a computer can recognize or use. To represent
anything meaningful, the computer uses bits in
groups. A group of eight bits is called
of a byte is called a nible.
byte. Half
There are two pos-
TEXT CODES
sible state for a switch, on and o. In a byte Early programmers realized that they needed a
there are eight switches. To calculate the num- standard text code that was agreeable to all of
ber of patterns, raise 2 to the number of bits, i.e. them. In such a system, numbers would represent

2
the letters of the alphabet, punctuation marks, over other text code systems is its compatibility
and other symbols. This standard code system with ASCII codes. The rst 256 codes in Unicode
would enable any programmer or program to use are identical to the 256 codes used by the ASCII
the same combination of numbers to represent and Extended ASCII systems.
the same individual pieces of data. A few most
popular text code systems invited are the follow-
ing:
DECIMAL SYSTEM
As mentioned in the intro that our present system
EBCDIC of numbers, the decimal system, has 10 separate
symbols which are used to construct the remain-
EBCDIC stands forExtended Binary Coded
ing numbers. In decimal system the number 4728
Decimal Interchange Code. It is an eight-bit
means four thousands, seven hundreds, two tens,
code that denes 256 symbols. It is still used in
and eight ones:
IBM mainframe and mid-range systems, but it is
rarely encountered in personal computers.
4728 = (4 × 1000) + (7 × 100) + (2 × 10) + (8 × 1)

ASCII The decimal system is said to have a base, or


radix, of 10. This means that each digit in the
American Standard Code
ASCII stands for
number is multiplied by 10 raised to power cor-
for Information Interchange. Today, the
responding to the digit's position:
ASCII character set is by far the most commonly
used in computers of all types. Table shows the
4728 = (4 × 103 ) + (7 × 102 ) + (2 × 101 ) + (8 × 100 )
128 ASCII codes. ASCII is an eight-bit code that
species characters for values from 0 to 127. The same principle holds for decimal fractions
but negative power of 10 are used. For example
Extended ASCII the number 0.4728 in decimal format would be:

Extended ASCII is an eight-bit code that spec- 0.4728 = (4×10−1 )+(7×10−2 )+(2×10−3 )+(8×10−4 )
ies the characters from values from 128 to 255.
The rst 40 symbols represent pronunciation and Similarly 192.685 in decimal format would be:
special punctuation. The remaining symbols are
graphic symbols.
192.685 = (1 × 102 ) + (9 × 101 ) + (2 × 100 )
+(6 × 10−1 ) + (8 × 10−2 ) + (5 × 10−3 )
Unicode In general, the decimal representation of X
would be as:
The Unicode Worldwide Character Stan-
dard provides up to four bytes (32 bits) to rep- X = . . . + (d2 × 102 ) + (d1 × 101 ) + (d0 × 100 )
resent each letter, number, or symbol. With four +(d−1 × 10−1 ) + (d−2 × 10−2 ) + . . .
bytes, enough Unicode codes can be created to
represent more than 4 billion dierent characters , and/or in more compact form X can be rep-
or symbols. This total is enough for every unique resented as:
character and symbol in the world, including the X
vast Chinese, Korean, and Japanese character set X= (di × 10i ) (1)
and those found in known classical and historical i
texts. In addition to world letters, special math- where i = . . . , 3, 2, 1, 0, −1, −2, −3, . . ..
ematical and scientic symbols are represented in The Romans and Greeks had their own nu-
Unicode. One major advantage that Unicode has meral systems as illustrated in Table 2. It was

3
Table 1: ASCII Codes

4
Table 2: Roman and Greek number system.

Figure 6: Arithmetic operations in decimal sys-


tem.

BINARY SYSTEM
Figure 5: Abacus device.
In binary system, only two digits, 1 and 0 are
used to construct all the remaining numerals.

very dicult to do the basic arithmetic opera- Thus, number in the binary system are repre-

tions in these early systems. It was this clumsi- sented to the base 2. In order to avoid confusion

ness of these systems and others like these, that between decimal number system and binary num-

forced mathematicians of the time to perform ber system or for that instant any other number

arithmetic operations almost entirely on abacus, system, we put subscript on a number to indi-

as shown in Figure 5, or counting boards, trans- cate its base. For example if we write the number

lating their results back to Roman and Greek nu- 1001 then it might create confusion that whether

merals form. Pencil-and-paper computation are its a decimal number or binary. On the other

unbelievably intricate and dicult in such sys- hand, if the same number is written in the for-

tems. In fact, the ability to perform such opera- mat 100110 and 10012 then it is much more clear,

tions as addition and multiplication was consid- that which family of number it belong to. As was

ered a great accomplishment in earlier civiliza- previously explained, the number 12510 actually

tions. means

Now the great beauty lies in the simplicity of


12510 = (1 × 102 ) + (2 × 101 ) + (5 × 100 )
the decimal numbering system. It is necessary
to learn the 10 basic numerals and the positional
In binary system, the same number (12510 ) is
notational system in order to count to any de-
represented as 11111012 , meaning:
sired gure. After memorizing few simple ad-
dition, subtraction, multiplication, and division 11111012 = (1 × 26 ) + (1 × 25 ) + (1 × 24 )
rules, one can perform all arithmetic operations. +(1 × 23 ) + (1 × 22 ) + (0 × 21 ) + (1 × 20 )
Notice the simplicity of adding, subtracting, mul-
tiplying, and dividing two numbers in decimal similarly the number 111.1012 is represented
system illustrated in Figure 6. as:

5
digit. The only case in which this occurs with
binary numbers is when 1 is subtracted from 0.
111.1012 = (1 × 22 ) + (1 × 21 ) + (1 × 20 )
The remainder is 1, but it is necessary to borrow
+(1 × 2−1 ) + (0 × 2−2 ) + (1 × 2−3 )
1 from the next column to the left. The complete
set of binary subtraction is as following:
In general, the binary representation of Y
would be as:
0 − 0 = 0
Y = . . . + (d2 × 22 ) + (d1 × 21 ) + (d0 × 20 )
1 − 0 = 1
+(d−1 × 2−1 ) + (d−2 × 2−2 ) + . . .
1 − 1 = 0
and/or in more compact form Y can be repre-
0 − 1 = 1 with a borrow of 1
sented as:
Examples of binary addition of larger numbers
X
i
Y = (di × 10 ) (2) is given below:
i

where i = . . . , 3, 2, 1, 0, −1, −2, −3, . . .. 1 0 12


− 1 02
Binary Addition and Subtraction _ _ _
1 12
Binary addition is performed in the same manner
as decimal addition. The complete set of binary
addition is as following:

1 1 0 . 0 12
0 + 0 = 0
− 1 0 0 . 12
0 + 1 = 1
_ _ _ _ _ _ _
1 + 0 = 1
1 . 1 12
1 + 1 = 0 plus a carry − over of 1

Carry-overs are performed in the same manner


as in the decimal arithmetic. Since 1 is the largest
Binary Multiplication and Division
digit in binary system, so any sum greater than 1
Binary multiplication is very short and simple,
requires that a digit be carried over. Examples of
with only four entries instead of the 100 necessary
binary addition of larger numbers is given below:
for decimal multiplication. The complete set of

1 0 12 binary multiplication is as following:

+ 1 1 02
_ _ _ _ 0 × 0 = 0
1 0 1 12 1 × 0 = 0
0 × 1 = 0
1 × 1 = 1
1 1 . 1 12
+ 1 1 . 1 02
_ _ _ _ _ _ In binary multiplication it is only necessary to

1 1 1 . 0 12 copy the multiplicand if the digit in the multi-


plier is 1 and to copy all 0s if the digit in the
Subtraction is the inverse operation of addi- multiplier is a 0. The following examples illus-
tion. To subtract, it is necessary to establish a trates the simplicity of binary multiplication and
procedure for subtracting a larger from a smaller the ease with which the operation is performed.

6
1 1 0 0
× 1 0 1 0
_ _ _ _ _ _ _
0 0 0 0
1 1 0 0
0 0 0 0
1 1 0 0
_ _ _ _ _ _ _
1 1 1 1 0 0 0

1 1 0 0 1 1 0
× 1 0 0 0
_ _ _ _ _ _ _ _ _ _
1 1 0 0 1 1 0 0 0 0

1 . 0 1
× 1 0 . 1
_ _ _ _ _ _
1 0 1
0 0 0
1 0 1
Figure 7: Binary division.
_ _ _ _ _ _
1 1 . 0 0 1

Binary division is again, very simple. As in the


 If X >= Y, the quotient bit is 1 and
perform the subtraction X-Y.
decimal system, division by zero is meaningless.
The complete set of division is very simple as  If X < Y, the quotient bit is 0 and do
following: not perform any subtractions.

0 ÷ 1 = 0
1 ÷ 1 = 1 • Shift Y one bit to the right and go to step 2
in Figure 7.

The binary division is explained in Figure 7.


To perform binary division follow the following
steps:
Conversion between Binary and Deci-
mal Numbers
• Align the divisor (Y) with the most signif-
In order to convert a decimal number into binary,
icant end of the dividend. Let the portion
the decimal number is repeatedly divided by 2,
of the dividend from its most signicant bit
and the remainder after each division is used to
(MSB) to its bit aligned with the least sig-
indicate the coecient of the binary number to be
nicant bit (LSB) of the divisor be denoted
formed. For example the following example illus-
X.
trate the conversion process of converting 12510
• Compare X and Y. into binary number.

7
125 ÷ 2 = 62 + remainder of 1 102 ÷ 2 = 51 + remainder of 0
62 ÷ 2 = 31 + remainder of 0 51 ÷ 2 = 25 + remainder of 1
31 ÷ 2 = 15 + remainder of 1 25 ÷ 2 = 12 + remainder of 1
15 ÷ 2 = 7 + remainder of 1 12 ÷ 2 = 6 + remainder of 0
7 ÷ 2 = 3 + remainder of 1 6 ÷ 2 = 3 + remainder of 0
3 ÷ 2 = 1 + remainder of 1 3 ÷ 2 = 1 + remainder of 1
1 ÷ 2 = 0 + remainder of 1 1 ÷ 2 = 0 + remainder of 1

Now the binary number is obtained from the So the binary representation for 10210 is
remainders in the division process such that the 11001102 . Now the fraction part 0.437510 has
remainder at the bottom will be the MSB of to converted into binary. Dierent methods can
the binary number and the remainder at the top be adopted but the most easiest and straight for-
would be the LSB of the primary number. By ward method is adopted here as illustrated below.
follwing this procedure the binary representation
of 12510 is, therefore, 11111012 . binary representation
The conversion of binary number 11111012 ob- 2 × 0.4375 = 0.8750 0.0
tained in the last example to a decimal is illus- 2 × 0.8750 = 1.750 0.01
trated as following: 2 × 0.750 = 1.50 0.011
2 × 0.50 = 1.0 0.0111
1 × 26 = 64
1 × 25 = 32 It can be seen in the above example that the

1 × 24 = 16 fractional portion of the decimal number is mul-

1 × 23 = 8 tiplied by 2 and if the resulting number has 1

1 × 22 = 4 appears to the left of the decimal point, a 1 is

0 × 21 = 0 added to the right of the binary fraction being

1 × 20 = 1 formed. If after a multiplication by 2, 0 remains

_ to the left of the decimal point of the decimal

12510 number, a 0 is added to the right of the binary


number. The process is stopped when after mul-
As can be seen in the last example that for bi- tiplication by 2 the result comes out to be only 1.
nary to decimal conversion, the binary number is The binary representation of 0.437510 is, there-
written from top to bottom with MSB at the top fore, 0.01112 . Now at the end both the binary
and LSB at the bottom. then they are multiplied numbers are combined together to get the nal
with 2i , where i is the position of corresponding conversion of decimal to binary. So the decimal
binary bit in the complete number. At the end, to binary conversion for 102.437510 . would be
the result obtained from each individual multipli- 1100110.01112 . the result can be veried by con-
cation is added to get the nal decimal number. verting the binary number back to decimal sys-
The above method will not work on binary tem
numbers with fractions. In order to use a similar History records the use of several other num-
method, rst it is necessary to divide the num- ber systems. The quinary system, which has
ber into its whole and fraction parts. For exam- 5 for its base, was prevalent among Eskimos
ple consider the decimal number 102.437510 . It and North American Indian. Examples of the
would be rst divided into 10210 and 0.437510 . duodecimal system (base 12) may be seen in
The binary representation of each part is then clocks, inches and feet, and dozens or grosses.
calculated as following: There are many more latest numbering systems

8
are present e.g. Binary-coded-decimal (BCD),
Excess-3 codes, Octal, and Hexadecimal num-
bers, are few examples.

You might also like