2 - Number System
2 - Number System
INTRODUCTION
There are several kinds of data such as ( numeric,
text, date, graphics, image, audio and video) that
need to be processed by a computer.
The text data usually consist of standard alphabetic,
numeric, and special characters.
The graphics data consist of still pictures such as
drawings and photographs.
Any type of sound, including music and voice, is
considered as audio data.
Video data consist of motion pictures.
The data has to be converted into a format that the
computer understands.
INTRODUCTION
Data can be classified into two forms, analog
data and digital data.
Analog data can have any value within a
defined range and it is continuous.
Sound waves, Telephone signals,
temperatures and all other signals that are
not broken into bits are examples of analog
data.
Digital data can be represented by a series of
binary numbers and it is discrete.
INTRODUCTION
The Arithmetic and Logic Unit (ALU) of the computer performs
arithmetic and logical operations on data.
Computer arithmetic is commonly performed on two different
types of numbers, integer and floating point. As the hardware
required for arithmetic is much simpler for integers than
floating point numbers, these two types have entirely
different representations
. An integer is a whole number and the floating-point number
has a fractional part.
To understand about how computers store data in the memory
and how they handle them, one must know about bits and
bytes and the number systems.
BITS AND BYTES
Bits and bytes are common computer terminology .
Both the main memory (Random Access Memory or
RAM) and the hard disk capacities are measured in
terms of bytes.
A numbering system is a way of representing
numbers. The most commonly used numbering
system is the decimal system.
Computer systems can perform computations and
transmit data thousands of times faster in binary
form than they can use decimal representations.
BITS AND BYTES
A bit is small piece of data that is derived from the words
“binary digit”. Bits have only two possible values, 0 and 1.
A binary
number contains a sequence of 0s and 1s like 10111.
A collection of 8 bits is called as a byte. With 8 bits in a
byte, we can represent 256
values ranging from 0 to 255 as shown below:
0 0 0 0 0 0 0 0= 0
0 0 0 0 0 0 0 1=1
0 0 0 0 0 0 1 0=2
…………………………
1 1 1 1 1 1 1 1=255
BITS AND BYTES
Bytes are used to represent characters in a text. Different types of
coding schemes are used to represent the character set and
numbers.
The most commonly used coding scheme is the American
Standard Code for Information Interchange (ASCII).
Each binary value between 0 and 127 is used to represent a
specific character.
The ASCII value for a blank character (blank space) is 32 and the
ASCII value of numeric 0 is 48.
The range of ASCII values for lower case alphabets is from 97 to
122 and the range of ASCII values for the upper case alphabets
is 65 to 90
BITS AND BYTES
Computer memory is normally represented in terms of
Kilobytes or Megabytes
The decimal system (base 10)
The word decimal is derived from the Latin root decem
(ten).
In this system the base b = 10 and we use ten symbols
S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
2.9
The binary system (base 2)
The word binary is derived from the Latin root bini (or two
by two). In this system the base b = 2 and we use only
two symbols,
S = {0, 1}
2.10
The hexadecimal system (base 16)
The word hexadecimal is derived from the Greek root hex
(six) and the Latin root decem (ten). In this system the base
b = 16 and we use sixteen symbols to represent a number.
The set of symbols is
S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
2.11
The octal system (base 8)
The word octal is derived from the Latin root octo (eight).
In this system the base b = 8 and we use eight symbols to
represent a number. The set of symbols is
S = {0, 1, 2, 3, 4, 5, 6, 7}
2.12
Summary of the four positional systems
Table 2.1 shows a summary of the four positional number
systems discussed in this chapter.
2.13
Table 2.2 shows how the number 0 to 15 is represented in
different systems.
2.14
CONVERSION AMONG BASES
The possibilities:
Decimal Octal
Binary Hexadecimal
pp. 40-
46
BINARY TO DECIMAL
EXAMPLE
1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
OCTAL TO DECIMAL
EXAMPLE
4 4 x 80 = 7248 =>
16 2 x 81 =
448 7 x 82 =
46810
HEXADECIMAL TO DECIMAL
EXAMPLE
ABC16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
DECIMAL TO BINARY
THERE ARE TWO APPROACHES FOR CONVERTING
A DECIMAL NUMBER INTO BINARY FORMAT: .
First approach Any decimal number divided by 2 will
leave a remainder of or 1. Repeated division by 2
will leave a string of 0s and 1s that become the
binary equivalent of the decimal number.
Suppose it is required to convert the decimal number
M into binary form, dividing M by 2 in the decimal
system, we will obtain a quotient M1 and a
remainder r1, where r1 can have a value of either 0
or 1.
EXAMPLE :
CONVERT INTO ITS EQUIVALENT BINARY NUMBER.
64 32 16 8 4 2 1
0 1 0 0 1 0 0
DECIMAL TO BINARY
EXAMPLE 2 125
62 1
2
12510 = ?2 2
31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1
12510 = 11111012
OCTAL TO BINARY
EXAMPLE 7058 = ?2
7 0 5
7058 = 1110001012
HEXADECIMAL TO BINARY
EXAMPLE 10AF16 = ?2
1 0 A F
10AF16 = 00010000101011112
DECIMAL TO OCTAL
EXAMPLE
123410 = ?8
8 1234
8 154 2
8 19 2
8 2 3
0 2
123410 = 23228
DECIMAL TO HEXADECIMAL
EXAMPLE
123410 = ?16
16 1234
16 77 2
16 4 13 = D
0 4
123410 = 4D216
BINARY TO OCTAL
EXAMPLE 10110101112 = ?8
1 3 2 7
10110101112 = 13278
BINARY TO HEXADECIMAL
EXAMPLE 10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
OCTAL TO HEXADECIMAL
EXAMPLE 10768 = ?16
1 0 7 6
2 3 E
10768 = 23E16
HEXADECIMAL TO OCTAL
EXAMPLE 1F0C16 = ?8
1 F 0 C
1 7 4 1 4
1F0C16 = 174148
QUICK EXAMPLE