Number Sys

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

COMPUTER NUMBER SYSTEMS

INTRODUCTION

"A set of values used to represent different


quantities is known as Number System".
For example, a number system can be used to
represent the number of students in a class or
number of viewers watching a certain TV
program etc. The digital computer represents
all kinds of data and information in binary
numbers. It includes audio, graphics, video,
text and numbers.
Compiled by: Enihe Raphael O. 209
COMPUTER NUMBER SYSTEMS

Some important number systems are as follows.


Decimal number system
Binary number system
Octal number system
Hexadecimal number system
The decimal number system is used in general. However,
the computers use binary number system. The octal and
hexadecimal number systems are used in the computer

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.
Compiled by: Enihe Raphael O. 210
COMPUTER NUMBER SYSTEMS
BITS AND BYTES

Computer systems can perform computations and transmit


data thousands of times faster in binary form than they can
use decimal representations.

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 a byte. With 8 bits in a
byte, we can represent 256 values ranging from 0 to 255 as
shown below:
Compiled by: Enihe Raphael O. 211
COMPUTER NUMBER SYSTEMS
BITS AND BYTES
0 = 0000 0000
1 = 0000 0001
2 = 0000 0010
3 = 0000 0011
………….
………….
………….
254 = 1111 1110
255 = 1111 1111
Computer memory is normally represented in terms of
Kilobytes or Megabytes. In metric system, one Kilo
represents 1000, that is, 103. In binary system, one Kilobyte
represents 1024 bytes, that is, 210. The following table
shows the representation ofby: various
Compiled Enihe Raphael O. memory sizes. 212
COMPUTER NUMBER SYSTEMS
BITS AND BYTES

*Read as 2 power10.
In a 2GB (Gigabytes) storage device (hard disk), totally
21,47,483,648 bytes can be stored.
Compiled by: Enihe Raphael O. 213
COMPUTER NUMBER SYSTEMS
DECIMAL NUMBER SYSTEM
The number system that we use in our day-to-day life is the
decimal number system.
Decimal number system has base 10 as it uses 10 digits from
0 to 9.
In decimal number system, the successive positions to the left
of the decimal point represent units, tens, hundreds, thousands
and so on.
Each position represents a specific power of the base (10).
For example, the decimal number 1234 consists of the digit 4 in
the units position, 3 in the tens position, 2 in the hundreds
position, and 1 in the thousands position, and its value can be
written as:
(1x1000)+ (2x100)+ (3x10)+ (4x1)
(1x103)+ (2x102)+ (3x101)+ (4x100)
1000 + 200 + 30 + 4 Compiled by: Enihe Raphael O. 214

1234
COMPUTER NUMBER SYSTEMS
DECIMAL NUMBER SYSTEM

Fractional values are represented


in the same manner, but the
exponents are negative for digits
on the right side of the decimal
point. Thus the value of the
fractional decimal sequence
948.23 is:
948.2310 = 9 X 102 + 4 XCompiled
101 by:+Enihe 10O.0 + 2 X 10-1 + 3 X 10-2215
8 XRaphael
BINARY NUMBER SYSTEM

Characteristics of binary number system are as follows:


Uses two digits, 0 and 1.
Also called base 2 number system
Each position in a binary number represents a power of
the base (2). Example 20
Example
Binary Number : 101012
Calculating Decimal Equivalent:
Step Binary Number Decimal Number
Step1 101012 ((1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10
Step 2 101012 (16 + 0 + 4 + 0 + 1)10
Step 3 101012 2110
Note : 101012 is normally written as 10101.
Compiled by: Enihe Raphael O. 216
COMPUTER NUMBER SYSTEMS
BINARY NUMBER SYSTEM

The decimal equivalent of the fractional binary


sequence can be estimated in the same manner.
The exponents are negative powers of two for digits
on the right side of the binary point. The binary
equivalent of the decimal point is the binary point.
Thus the decimal value of the fractional binary
sequence 0.10112 is:
0.10112 = 1 X 2-1 + 0 X 2-2 + 1 X 2-3 + 1 X 2-4
= 0.5 + 0 + 0.125 + 0.0625
= 0.687510
Compiled by: Enihe Raphael O. 217
COMPUTER NUMBER SYSTEMS
OCTAL NUMBER SYSTEM

Characteristics of octal number system


are as follows:
Uses eight digits, 0,1,2,3,4,5,6,7.
Also called base 8 number system
Each position in an octal number
represents a power of the base (8).
Example 80
Compiled by: Enihe Raphael O. 218
COMPUTER NUMBER SYSTEMS
OCTAL NUMBER SYSTEM

Example
Octal Number : 125708
Calculating Decimal Equivalent:
Step Octal Number Decimal Number
Step 1 125708 ((1 x 84) + (2 x 83) + (5 x 82) + (7 x 81) + (0 x 80))10
Step 2 125708 (4096 + 1024 + 320 + 56 + 0)10
Step 3 125708 549610
Note : 125708 is normally written as 12570.

Compiled by: Enihe Raphael O. 219


COMPUTER NUMBER SYSTEMS
HEXADECIMAL NUMBER SYSTEM

Characteristics of hexadecimal number


system are as follows:
Uses 10 digits and 6 letters,
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
Letters represents numbers starting from 10.
A = 10. B = 11, C = 12, D = 13, E = 14, F = 15.
Also called base 16 number system
Each position in a hexadecimal number
represents a power of the base (16). Example
160 Compiled by: Enihe Raphael O. 220
COMPUTER NUMBER SYSTEMS
HEXADECIMAL NUMBER SYSTEM

Example
Hexadecimal Number : 19FDE16
Calculating Decimal Equivalent:
Step Hexa Number Decimal Number
Step 1 19FDE16 ((1 x 164) + (9 x 163) + (F x 162) + (D x 161) + (E x 160))10
Step 2 19FDE16 ((1 x 164) + (9 x 163) + (15 x 162) + (13 x 161) + (14 x 160))10
Step 3 19FDE16 (65536+ 36864 + 3840 + 208 + 14)10
Step 4 19FDE16 10646210
Note : 19FDE16 is normally written as 19FDE.

Compiled by: Enihe Raphael O. 221


COMPUTER NUMBER SYSTEMS
DECIMAL TO BINARY CONVERSION
To convert a binary number to a decimal number, it
is required to multiply each binary digit by the
appropriate power of 2 and add the results (as
shown in previous slides).
We will consider the easiest approach for
converting a decimal number into binary format
which is Repeated Division by 2

Repeated Division by 2
Any decimal number divided by 2 will leave a
remainder of 0 or 1. Repeated division by 2 will
leave a string of 0s and 1s that become the binary
Compiled by: Enihe Raphael O. 222
equivalent of the decimal number.
COMPUTER NUMBER SYSTEMS
DECIMAL TO BINARY CONVERSION - Repeated Division by 2
Example:

To write the binary equivalent of the decimal


number, read the remainders from the bottom
upward as:
2310 = 101112 Compiled by: Enihe Raphael O. 223
COMPUTER NUMBER SYSTEMS
CONVERSION OF FRACTIONAL DECIMAL TO BINARY

The steps involved are:


Multiply the decimal fraction by 2 and note the
integer part. The integer part is either 0 or 1.
Discard the integer part of the previous product.
Multiply the fractional part of the previous product
by 2. Repeat the first step until the fraction repeats
or terminates.

The resulting integer part forms a string of 0s and


1s that becomes the binary equivalent of the
decimal fraction.
Compiled by: Enihe Raphael O. 224
COMPUTER NUMBER SYSTEMS
CONVERSION OF FRACTIONAL DECIMAL TO BINARY
Example:

(Fraction repeats, the product is the same as in the


first step)

Read the integer parts from top to bottom to obtain


the equivalent fractional binary number. Hence
Compiled by: Enihe Raphael O. 225
0.210 = 0.00110011…2
COMPUTER NUMBER SYSTEMS
CONVERSION OF OTHER BASE SYSTEM TO DECIMAL SYSTEM
DONE
Steps
Step 1 - Determine the column (positional) value
of each digit (this depends on the position of the
digit and the base of the number system).

Step 2 - Multiply the obtained column values (in


Step 1) by the digits in the corresponding
columns.

Step 3 - Sum the products calculated in Step 2.


The total is the equivalent value in decimal.
Compiled by: Enihe Raphael O. 226
COMPUTER NUMBER SYSTEMS
CONVERSION OF OTHER BASE SYSTEM TO DECIMAL SYSTEM

Example
Binary Number : 111012
Calculating Decimal Equivalent:

Step Bin. Number Decimal Number


Step 1 111012 ((1 x 24) + (1 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10
Step 2 111012 (16 + 8 + 4 + 0 + 1)10
Step 3 111012 2910

Binary Number : 111012 = Decimal Number : 2910


Compiled by: Enihe Raphael O. 227
COMPUTER NUMBER SYSTEMS
CONVERSION OF DECIMAL TO HEXADECIMAL
Decimal numbers’ conversion to hexadecimal is
similar to binary conversion. Decimal numbers can
be converted into hexadecimal format by repeated
division by 16.
The steps involved in the repeated division by 16 to
obtain the hexadecimal equivalent are as follows:

Divide the decimal number by 16 and note the


remainder. Express the remainder as a hex digit.

Repeat the process until the quotient is zero


Compiled by: Enihe Raphael O. 228
COMPUTER NUMBER SYSTEMS
Example: CONVERSION OF DECIMAL TO HEXADECIMAL

Same method can be applied to convert Decimal


to Octal Numbers by repeated division by 8.
Compiled by: Enihe Raphael O. 229
COMPUTER NUMBER SYSTEMS
OTHER BASE SYSTEM TO NON-DECIMAL SYSTEM
Steps
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.

Example
Octal Number : 258
Calculating Binary Equivalent:
Compiled by: Enihe Raphael O. 230
COMPUTER NUMBER SYSTEMS
OTHER BASE SYSTEM TO NON-DECIMAL SYSTEM
Example cont…
Octal Number : 258
Calculating Binary Equivalent:

Step 1 : Convert to Decimal


Step Octal Number Decimal Number
Step 1 258 ((2 x 81) + (5 x 80))10
Step 2 258 (16 + 5 )10
Step 3 258 2110

Octal Number : 258 = Decimal Number : 2110


Compiled by: Enihe Raphael O. 231
COMPUTER NUMBER SYSTEMS
OTHER BASE SYSTEM TO NON-DECIMAL SYSTEM

Step 2 : Convert Decimal to Binary


Step Operation Result Remainder
Step 1 21 / 2 10 1
Step 2 10 / 2 5 0
Step 3 5/2 2 1
Step 4 2/2 1 0
Step 5 1/2 0 1

Decimal Number : 2110 = Binary Number : 101012


Octal Number : 258 = Binary Number : 101012
Compiled by: Enihe Raphael O. 232
COMPUTER NUMBER SYSTEMS
SHORTCUT METHOD - BINARY TO OCTAL

Steps
Step 1 - Divide the binary digits into groups of
three (starting from the right).

Step 2 - Convert each group of three binary


digits to one octal digit.

Example
Binary Number : 101012
Calculating Octal Equivalent:
Compiled by: Enihe Raphael O. 233
COMPUTER NUMBER SYSTEMS
SHORTCUT METHOD - BINARY TO OCTAL

Example
Binary Number : 101012
Calculating Octal Equivalent:

Step Binary Number Octal Number


Step 1 101012 010 |101
Step 2 101012 210 | 510
Step 3 101012 258

Binary Number : 101012 = Octal Number : 258


Compiled by: Enihe Raphael O. 234
COMPUTER NUMBER SYSTEMS
SHORTCUT METHOD - OCTAL TO BINARY

Steps
Step 1 - Convert each octal digit to a 3 digit binary
number (the octal digits may be treated as decimal
for this conversion).

Step 2 - Combine all the resulting binary groups (of


3 digits each) into a single binary number.

Example
Octal Number : 258
Calculating Binary Equivalent:
Compiled by: Enihe Raphael O. 235
COMPUTER NUMBER SYSTEMS
SHORTCUT METHOD - OCTAL TO BINARY

Example
Octal Number : 258
Calculating Binary Equivalent:

Step Octal Number Binary Number


Step 1 258 210 510
Step 2 258 0102 1012
Step 3 258 0101012

Octal Number : 258 = Binary Number : 101012


Compiled by: Enihe Raphael O. 236
COMPUTER NUMBER SYSTEMS
SHORTCUT METHOD - BINARY TO HEXADECIMAL

Steps
Step 1 - Divide the binary digits into groups of four
(starting from the right).

Step 2 - Convert each group of four binary digits to


one hexadecimal symbol.

Example
Binary Number : 101012
Calculating hexadecimal Equivalent:
Compiled by: Enihe Raphael O. 237
COMPUTER NUMBER SYSTEMS
SHORTCUT METHOD - BINARY TO HEXADECIMAL

Example
Binary Number : 101012
Calculating hexadecimal Equivalent:

Step Binary Number Hexadecimal Number


Step 1 101012 0001 0101
Step 2 101012 110 510
Step 3 101012 1516

Binary Number : 101012 = Hexadecimal Number :


1516 Compiled by: Enihe Raphael O. 238
COMPUTER NUMBER SYSTEMS
SHORTCUT METHOD - HEXADECIMAL TO BINARY

steps
Step 1 - Convert each hexadecimal digit to a 4 digit
binary number (the hexadecimal digits may be
treated as decimal for this conversion).

Step 2 - Combine all the resulting binary groups (of


4 digits each) into a single binary number.

Example
Hexadecimal Number : 1516
Calculating Binary Equivalent:
Compiled by: Enihe Raphael O. 239
COMPUTER NUMBER SYSTEMS
SHORTCUT METHOD - HEXADECIMAL TO BINARY

Example
Hexadecimal Number : 1516
Calculating Binary Equivalent:

Step Hexadecimal Number Binary Number


Step 1 1516 110 510
Step 2 1516 00012 01012
Step 3 1516 000101012

Hexadecimal Number : 1516 = Binary Number :


101012 Compiled by: Enihe Raphael O. 240

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy