Anda di halaman 1dari 7

Chapter 2

NUMBER SYSTEM
Since early days people have been using their fingers, sticks and other
things for counting. In 3400BC ancient Egyptians started using special
symbols for writing numbers.
Number system can be classified into two broad categories.
NON-POSITIONAL NUMBER SYSTEM; In this system, every
number is represented by a symbol. This is also known as absolute
number system. An example of this system is Roman number system.
It is very difficult to perform arithmetic operations using this system.
POSITIONAL NUMBER SYSTEM: In this system, value of each
digit in a number is defined not only by the symbol but also by its
position. The positional number system that is currently used is called
decimal number system, it contains ten symbols.
BASE OR RADIX OF SYSTEM: Base or radix tells the number of
symbols used in the system. The radix is indicated by a subscript for
example.
(7592)10 (214)8 (123)16
TYPES OF NUMBER SYSTEM: The number systems used by computers
are as follows.
I. Decimal system
II. Binary number system
III. Octal number system
IV. Hexadecimal number system
DECIMAL NUMBER SYSTEM: The decimal number system uses ten
symbols 0 to 9 each digit in a base 10 number system represents units which
are ten times the units of digits to its rights.
For eg: 9735 can be expressed as 9x1000+7x100+3x10+5.
BINARY NUMBER SYSTEM: The CPU of a computer is made of
millions of switches that can be either in on or off states. The digits 0 and 1
are used to represent these states. Binary system has only two symbols 0 and
1 the value of each digit is determined by a power of 2.

OCTAL NUMBER SYSTEM: Octal number system has eight digits 0,


1,2,3,4,5,6,7. The weighting for each digit in octal system is a power of 8.
HEXADECIMAL NUMBER SYSTEM: Hexadecimal number system has
sixteen digits 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. the largest hexadecimal digit
F is equivalent to binary number 1111. The weighty of each digit in
hexadecimal system is a power of 16.
CONVERSION BETWEEN NUMBER BASES:
CONVERSION OF DECIMAL TO BINARY
Integer value: The method is called as the remainder method. It is
performed by repeated division of decimal integer by 2 and considering the
remainder in reverse order.
Eg: Find binary equivalent of (36)10
LSB

2 36
2 18- 0
2 9- 0
2 4- 1
2 2- 0
2 1- 0
0- 1

Binary number is 100100

MSB

FRACTIONS: Decimal fraction can be converted to binary by repeated


multiplication by 2 and considering the integer carry, until the fraction part
becomes zero.
Eg: Binary equivalent of (0.375)10
0.375x2 = 0.750
0
0.750x2 = 1.500
1
(0.375)10 = (0.011)2
0.500x2 = 1.000
1
CONVERSION OF BINARY TO DECIMAL: It is performed by
multiplying each digit by its weight and adding
Eg: convert (11010)2 to decimal
=1x24 + 1x23 + 0x22 + 1x 21 + 0x20
=16+8+0+2+0
=26
Fraction can be converted in same manner

Eg: convert 0.1011 to decimal


= 1x2-1+0x2-2+1x2-3+1x2-4
= 1/2+1/4+1/8+1/16
= 0.5+0.25+0.125+0.0625
= 0.9375
Conversion of decimal integer to octal, decimal fraction to octal, octal to
decimal can be performed in a similar manner by replacing 2 by 8 similarly
hexadecimal conversions can be performed by replacing 2 by 16.
CONVERSION OF OCTAL TO BINARY: Can be performed by
converting each digit of octal number to 3 bit binary form.
Eg: 2 3 5
(235)8 = (10011101)2
010 011 101
Fractions can be converted similarly
Eg: 3 5. 1 2 3 4
(35.1234)8 = (11101.001010011100)
011 101

001

010 011 100

CONVERSION OF BINARY TO OCTAL: Group binary number into


groups of 3 bits and convert each group to octal
Eg: 11010.11011101
(011) (010). (110) (111) (010)
3
2 . 6
7
2
(11010.11011101)2 = 32.762
CONVERSION OF HEXADECIMAL TO BINARY:
Similar to octal but convert each digit to 4 bit binary form.
Eg: 5
A
F .
6
C
0101

1010

1111

0110

1100

5AF.6C = (10110101111.01101100)2

Conversion of binary to hexadecimal can be performed by grouping binary


number into 4 bit groups and converting each group to hexadecimal
Eg: 1101110101. 11101111101101
(0011)(0111)(0101).(1110)(1111)(1011)(0100)
3
7
5
E
f
b
4
BINARY ARITHMETIC:
BINARY ADDITION: Binary addition is carried out in the same way as
decimal addition using sum and carry. There are four rules for binary
addition. They are listed as follows
INPUT
X

0
0
1
1

0
1
0
1

Example1:
1111
1010
11001
Example2:
1 1. 1 0
1 0. 1 0
110. 0 0

OUTPUT
Sum (s)
Carry(c)
0
1
1
0

15
10
25
3.5
2.5
6.0

0
0
0
1

BINARY SUBTRACTION: Subtraction uses difference and borrows. The


Rules of subtraction is given below
INPUT
X

0
0
1
1

0
1
0
1

OUTPUT
difference(d) borrow(b)
0
1
1
0

0
1
0
0

(10)

Example: 1 1 0 1
1011
0010

13
11
02

SIGNED AND UNSIGNED NUMBER: A bit signed consists of two parts:


sign and magnitude. The most significant bit (MSB)
Represents sign bits and the rest, its magnitude
MSB
Sign

magnitude

Eight bit signed number range from -127 to +127.In same application,
number are unsigned. They do not use sign bit. Hence an 8 bit unsigned
number ranges from 0 to 255.
MSB

LSB
Magnitude

COMPLIMENTS: The compliment of a number is the number which when


added to the original will makes it equal to a multiple of the base number
system.
1s compliment: 1s compliment of a binary number is formed when we
change each 1 to 0 and each 0 to 1.
Ex: 1s compliment of 1101 is 0010
2s compliment: we obtain 2s compliment of a binary number when we
add 1 to its 1s compliment.

Ex: 2s compliment of 1101


0010 +1 = 0011
SUBTRACTION OF BINARY NUMBER USING 2S COMPLIMENT
ADDITION: We can subtract a binary number from another by taking the
2s compliment of second number and adding then together. If there is a
carry after the MSB, ignore it. If there is no carry, re-compliment the result
and attach the ve sign.
Ex1: 27
11011
11
01011
16
10000
Take 2s compliment of 11
01011 -> 10100+1 = 10101
Now add the two numbers
11011
10101
110000
Ignoring the last carry we get 10000
Ex2: 25
011001
42
101010
-17
-10001
Take 2s compliment of 42
101010
010101+1 = 010110
Now add two numbers
011001
010110
101111
Now recompliment the result
101111-1 = 101110
-010001
BINARY CODING: Numbers, alphabet and special characters are
represented in computer in various formats. Commonly used formats are
given below.
BCD (BINARY CODED DECIMAL): In this method, each decimal digit
is represented using 4 binary digits.
Ex: 5319 is represented as
5
3
1
9
0101
0011 0001 1001
The advantage is there is no limit to size of the number. But this system can
represent only 24=16 symbols

ASCII: (American Standard Code for Information Interchange)


It is a 7 bit code consisting of 128 symbols which was later extend to 8 bit
version called ASCII-8 which contained 256 characters
Ex:
Character
0 9 A Z a z
ASCII

48 57 65 90 97 122

EBCDIC: (Extended Binary Coded Decimal Interchange Code)


User 8 bit and can represent 256 characters

Anda mungkin juga menyukai