NUMBER SYSTEM
• A number system is defined as a system of writing for
expressing numbers. It is the mathematical notation for
representing numbers of a given set by using digits or other
symbols in a consistent manner.
The value of any digit in a number can be determined by:
(i) The digit
(ii) Its position in the number
(iii) The base of the number system
• There are various types of the number system in
mathematics. The four most common number system types
are:
– Decimal number system (Base- 10)
– Binary number system (Base- 2)
– Octal number system (Base-8)
– Hexadecimal number system (Base- 16)
• DECIMAL NUMBER SYSTEM
DIGITS: 0,1,2,3,4,5,6,7,8,9
BASE: 10 EXAMPLE: (789)10
• BINARY NUMBER SYSTEM
DIGITS: 0,1
BASE: 2 EXAMPLE: (110)2
• OCTAL NUMBER SYSTEM
DIGITS: 0,1,2,3,4,5,6,7
BASE: 8 EXAMPLE: (765)8
• HEXA DECIMAL NUMBER SYSTEM
DIGITS: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
BASE: 16 EXAMPLE: (7AB)16
• Why are binary numbers used in digital electronics?
Digital electronics is based on the design that every signal in a
circuit is either in the state of “on” or “off” (or “high”/”low”,
or “true”/”false”, or “1”/”0″, depending on how you choose to
label the states). The work “binary” literarily means “two
states”.
If the voltage is sufficiently small (i.e. 0–1V), then you treat
that as “0V”, and if it is sufficiently high (i.e. 4–5V), you treat it
as “5V”. From infinite number of possibilities you now have to
manage only two.
• DECIMAL TO BINARY CONVERSION
Example : (25)10 …………. ()2
2 25
2 12 1
2 6 0
2 3 0
2 1 1
0 1
Ans: (11001)2
• DECIMAL TO BINARY CONVERSION
Example : (25.125)10 …………. ()2
2 25 0.125 x 2 0.250 0
2 12 1 0.250 x 2 0.5 0
2 6 0 0.5 x 2 1.0 1
2 3 0
2 1 1
0 1
Ans: (11001.001)2
• DECIMAL TO BINARY CONVERSION
Example : (25.325)10 …………. ()2
2 25 0.325 x 2 0.650 0
2 12 1 0.650 x 2 1.3 1
2 6 0 0.3 x 2 0.6 0
2 3 0 0.6 x 2 1.2 1
2 1 1 0.2 x 2 0.4 0
0 1 0.4 x 2 0.8 0
0.8 x 2 1.6 1
0.6 x 2
Ans: (11001.0101)2
TEST YOUR SKILL-1
Convert the following decimal number to binary
• 75.125
2 75 0.125 x 2 0.250 0
2 37 1 0.250 x 2 0.5 0
2 18 1 0.5 x 2 1.0 1
2 9 0
2 4 1
2 2 0
2 1 0
0 1
Ans: 1001011.001
TEST YOUR SKILL-2
Convert the following decimal number to binary
• 97.425
2 97 0.425 x 2 0.850 0
2 48 1 0.850 x 2 1.7 1
2 24 0 0.7 x 2 1.4 1
2 12 0 0.4 x 2 0.8 0
2 6 0 0.8 x 2 1.6 1
2 3 0
2 1 1
0 1
Ans: 1100001.0110
• BINARY TO DECIMAL CONVERSION
Example : (101010.0101)2 …………. ()10
Consider a decimal number 3285 it can be written as
3285 = 3000 + 200 + 80 + 5
3285 = 3(103) + 2(102) + 8(101) + 5(100)
Similarly, in the binary number system each digit
position has a weight regarding powers of two.
• Example 1
Considered the conversion of the binary number 10101 into
its equivalent decimal numbers
Least Significant Bit
Most Significant Bit
• Example 2
Binary to Decimal Conversion For Mixed Number
the conversion of a binary number 1101.101 into its
equivalents decimal number
= 8+4+1+0.5+0.125
= 13.625
TEST YOUR SKILL-1
Convert the following binary number to decimal
• 1010110
1 0 1 0 1 1 0
26 25 24 23 22 21 20
1x64 0x32 1x16 0x8 1x4 1x2 0x1
64 0 16 0 4 2 0
=64+16+4+2
=86
TEST YOUR SKILL-2
Convert the following binary number to decimal
• 1011101.011
1 0 1 1 1 0 1 0 1 1
26 25 24 23 22 21 20 2-1 2-2 2-3
1x64 0x32 1x16 1x8 1x4 0x2 1x1 0x0.5 1x0.25 1x0.125
64 0 16 8 4 0 1 0 0.25 0.125
=64+0+16+8+4+0+1+0.25+0.125
=93.375
• DECIMAL TO OCTAL CONVERSION
Example: (278)10 …………. ()8
8 278
8 34 6
8 4 2
0 4
Ans: (426)8
• DECIMAL TO OCTAL CONVERSION OF MIXED NUMBERS
Example: (278.0625)10 …………. ()8
.0625 X 8 0.5 0
0.5 X 8 4.0 4
Ans: (426.04)8
• TEST YOUR SKILL-3
• DECIMAL TO OCTAL CONVERSION
(98)10 …………. ()8
8 98
8 12 2
8 1 4
0 1
Ans: (142)8
• TEST YOUR SKILL-4
• DECIMAL TO OCTAL CONVERSION
(125.65)10 …………. ()8
8 125
8 15 5 .65 X 8 5.2 5
8 1 7 0.2 X 8 1.6 1
0 1 0.6 x 8 4.8 4
0.8 x 8 6.4 6
Ans: (175.5146)8
• OCTAL TO DECIMAL CONVERSION
Example: (426.04)8 …………………… ()10
= 4x82+2x81+6x80+0x8-1+4x8-2
= 256+16+6+0+0.0625
= 278.0625
• TEST YOUR SKILL-1
(345.6)8 …………………… ()10
= 3x82+4x81+5x80+6x8-1
= 192+32+5+0.75
= 229.75
• TEST YOUR SKILL-2
(123.04)8 …………………… ()10
= 1x82+2x81+3x80+0x8-1+4x8-2
= 64+16+3+0+0.0625
= 83.0625
• DECIMAL TO HEXADECIMAL CONVERSION A=10
Example: (285)10 …………. ()16
B=11
16 285
C=12
16 17 13 (D)
16 1 1
D=13
0 1 E=14
F=15
Ans: (11D)16
• DECIMAL TO HEXADECIMAL CONVERSION OF MIXED NUMBERS
Example: (285.325)10 …………. ()16
.325 X 16 5.2 5
0.2 X 16 3.2 3
Ans: (11D.53)16
• HEXADECIMAL TO DECIMAL CONVERSION
A=10
Example: (ABC.D)16 …………………… ()10
B=11
= 10x162+11x161+12x160+13x16-1 C=12
= 2560+176+12+0.8125 D=13
= 2748.8125 E=14
F=15
• TEST YOUR SKILL-3 A=10
• DECIMAL TO HEXADECIMAL CONVERSION
B=11
(198.3)10 …………. ()16
C=12
16 198
D=13
16 12 6
0 12 (C) E=14
F=15
.3 X 16 4.8 4
0.8 x 16 12.8 12 (C)
0.8 x 16
Ans: (C6.4C)16
• TEST YOUR SKILL-4
• HEXADECIMAL TO DECIMAL CONVERSION A=10
B=11
Example: (B7C.E)16 …………………… ()10
C=12
= 11x162+7x161+12x160+14x16-1
D=13
= 2816+112+12+0.875 E=14
= 2940.875 F=15
• BINARY TO OCTAL CONVERSION
Example : (101010.0101)2 …………. ()8
In octal the highest digit is 7. The binary value of 7 is 111. So
in binary to octal we make a group of three bits before and
after the decimal.
1 0 1 0 1 0 . 0 1 0 1
101 010 . 010 100
5 2 . 2 4
Ans: (52.24)8
• OCTAL TO BINARY CONVERSION
Example : (123.4)8 …………. ()2
In octal the highest digit is 7. The binary value of 7 is 111. So
in octal to binary we convert each digit in it’s respective
binary form.
1 2 3 . 4
001 010 011 . 100
Ans: (001010011.100)2
• BINARY TO HEXA DECIMAL CONVERSION
Example : (101010.010111)2 …………. ()16
In hexa decimal the highest digit is 15. The binary value of 15
is 1111. So in binary to hexa decimal we make a group of four
bits before and after the decimal.
0 0 1 0 1 0 1 0 . 0 1 0 1 1 1 0 0
0010 1010 . 0101 1100
2 10 . 5 12
Ans: (2A.5C)16
• HEXA DECIMAL TO BINARY CONVERSION
Example : (AB0.1E)16 …………. ()2
In hexa decimal the highest digit is 15. The binary value of 15
is 1111. So in hexa decimal to binary we convert each digit in
it’s respective binary form.
A B 0 . 1 E
1010 1011 0000 . 0001 1110
Ans: (101010110000.00011110)2
• OCTAL TO HEXA DECIMAL CONVERSION
Example : (123.4)8 …………. ()16
In this conversion we first convert octal to binary as
1 2 3 . 4
001 010 011 . 100
1010011.1
then convert binary to hexa decimal
0 1 0 1 0 0 1 1 . 1 0 0 0
Ans: (53.8)16
• HEXA DECIMAL TO OCTAL CONVERSION
Example : (ABC.D)16 …………. ()8
In this conversion we first convert hexa decimal to binary as
A B C . D
1010 1011 1100 . 1101
101010111100.1101
1 0 1 0 1 0 1 1 1 1 0 0 . 1 1 0 1 0 0
Ans: (5274.64)8
BINARY REPRESENTATION OF INTEGERS
• Sign and Magnitude Representation
• One’s compliment
• Two’s compliment
Sign and Magnitude Representation
• It is the conventional form for number
representation.
Most significant bit (MSB)
0 for positive number
1 for negative number
Example (27)10 0 0 0 1 1 0 1 1
(-27)10 1 0 0 1 1 0 1 1
One’s Compliment
• It represent positive numbers by their binary
equivalents and negative numbers by their 1’s
compliment.
Example (27)10
0 0 0 1 1 0 1 1
(-27)10 1 1 1 0 0 1 0 0
Drawback in 1’s compliment
(0)10 0 0 0 0 0 0 0 0
(-0)10 1 1 1 1 1 1 1 1
Suppose we have 8 bits
Minimum value is 0 0 0 0 0 0 0 0 =0
Maximum value is 1 1 1 1 1 1 1 1 = 255
It means we can represent 256 values i.e. 128 negative and
128 positive numbers.
In case of positive minimum value is 0 and maximum value is
127. In case of negative minimum value is-1 and maximum
value is -128. So range of value is -128 to 127 in 8 bits.
1 0 0 0 0 0 0 0
Discard 0 0 0 0 0 0 0 0
So in 1’s compliment 1 1 1 1 1 1 1 1
Write -83 into binary form using 1’s compliment form.
2 83
2 41 1
2 20 1
2 10 0
2 5 0
2 2 1
2 1 0
0 1
0 1 0 1 0 0 1 1
Ans: In 1’s compliment
1 0 1 0 1 1 0 0
Binary Addition
A B SUM CARRY
0 0 0 0
0 1 1 0 (1)2 + (1)2 = (10)2
(1)10 + (1)10 = (2)10
1 0 1 0
1 1 0 1
Example 1 0 1 0 1 21
+ 0 1 0 0 1 09
1 1 1 1 0 30
Two’s Compliment
• It represent positive numbers by their binary
equivalents and negative numbers by their 2’s
compliment.
Example (27)10
0 0 0 1 1 0 1 1
(-27)10
In 1’s compliment 1 1 1 0 0 1 0 0
Add 1 in 1’s compliment + 1
In 2’s compliment 1 1 1 0 0 1 0 1
Write -83 into binary form using 2’s compliment form.
2 83
2 41 1
2 20 1
2 10 0
2 5 0
2 2 1
2 1 0
0 1
0 1 0 1 0 0 1 1
In 1’s compliment
1 0 1 0 1 1 0 0
+ 1
In 2’s compliment
1 0 1 0 1 1 0 1
Arithmetic Operations
• Binary addition
• Binary subtraction
• Binary multiplication
• Binary division
Binary Addition
A B SUM CARRY
0 0 0 0
0 1 1 0 (1)2 + (1)2 = (10)2
(1)10 + (1)10 = (2)10
1 0 1 0
1 1 0 1
Example 1 0 1 0 1 21
+ 0 1 0 0 1 09
1 1 1 1 0 30
OCTAL ADDITION
• ADD 567 and 675
1 1
8 12
5 6 7
1 4
+
6 7 5
8 14
14 6 4
1 6
Ans: 1464
HEXADECIMAL ADDITION
• ADD ABC and DEF 16 27
1 1
1 11 (B)
A B C
+ 16 26
D E F
1 10 (A)
18 A B 16 24
1 8
A=10
Ans: 18AB
B=11
C=12
D=13
E=14
F=15
Binary Subtraction
A B Difference BORROW
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
0 10
Example 1 0 1 0 1 21
- 0 1 0 0 1 09
12
0 1 1 0 0
Subtract 1001001 – 11011
0 1 1 0
10 1 10
1 0 0 1 0 0 1 73
-
0 0 1 1 0 1 1 27
0 1 0 1 1 1 0 46
2 81
43
Subtract 81 – 43 2 40
21 1
Convert 81 into binary form 2 20
10 0
1
Convert 43 into binary form 2 10
5 0
2 5
2 0
1
2 2
1 1
0
2 1
0 0
1
0 1
0 10 0 1 1 10
1 0 1 0 0 0 1 81
- 0 1 0 1 0 1 1 43
0 1 0 0 1 1 0 38
2 81
43
Subtract 81 – 43 using 1’s compliment
2 40
21 1
=81+(-43)
2 20
10 0
1
1’s compliment of 81 is 2 10
5 0
0 1 0 1 0 0 0 1 2 5
2 0
1
2 2
1 1
0
2 1
0 0
1
1’s compliment of -43 is
0 1
1 1 0 1 0 1 0 0
0 0 1 0 1 0 1 1
1 1 1
0 1 0 1 0 0 0 1 81
+ 1 1 0 1 0 1 0 0 -43
0 0 1 0 0 1 0 1
1
0 0 1 0 0 1 1 0 38
2 81
43
Subtract 81 – 43 using 2’s compliment
2 40
21 1
=81+(-43)
2 20
10 0
1
2’s compliment of 81 is 2 10
5 0
0 1 0 1 0 0 0 1 2 5
2 0
1
1’s compliment of -43 is 2 2
1 1
0
2 1
0 0
1
1 1 0 1 0 1 0 0
0 1
2’s compliment of -43 is
1 1 0 1 0 1 0 1 0 0 1 0 1 0 1 1
1 1 1 1
0 1 0 1 0 0 0 1 81
+ 1 1 0 1 0 1 0 1 -43
0 0 1 0 0 1 1 0
0 0 1 0 0 1 1 0 38
Subtract 111101 – 101101 using 2’s compliment
111101+ (-101101)
0 0 1 0 1 1 0 1
In 1’s compliment
1 1 0 1 0 0 1 0
In 2’s compliment
1 1 0 1 0 0 1 1
1 1 1 1 1 1 1 1
0 0 1 1 1 1 0 1 61
+ -45
1 1 0 1 0 0 1 1
0 0 0 1 0 0 0 0 16
OCTAL SUBTRACTION
• SUBTRACT 712 and 665
6 80 10
7 1 2
-
6 6 5
0 2 5
Ans: 25
HEXADECIMAL SUBTRACTION
• SUBTRACT BA9 and AEF
A 259 25
B A 9
-
A E F
0 B A
A=10
Ans: BA
B=11
C=12
D=13
E=14
F=15
BINARY MULTIPLICATION
1 0 1 1
x 1 1 0
1
0 0 0 0
1 11 0 1 1 X
1
1 0 1 1 x x
1 0 0 0 0 1 0
BINARY DIVISION
10 10
101 110110
101
01 11
101
100
Quotient: 1010
Remainder: 100
Cross check: 101x1010+100=110110
REPRESENTING CHARACTERS IN MEMORY
• Every characters has a unique code. For example A=65 a=97 etc.
• The given unique code is converted into binary form and stored in the
required number of bits. For Example A=65
0 1 0 0 0 0 0 1
• Different codes used in computers 2 65
are: 2 32 1
ASCII (American Standard code for 2 16 0
Information Interchange) 7 bit code 2 8 0
EBCDIC (Extended Binary Coded 2 4 0
Decimal Interchange Code) 8 bit code 2 2 0
ISCII (Indian Standard Code for
2 1 0
Information Interchange) 8 bit code
0 1
UNICODE 16 bit code
BIT: A bit (short for "binary digit") is the smallest unit of
measurement used to quantify computer data. It contains a
single binary value of 0 or 1.
BYTE: A group of 8 bits make one byte.
WORD: A word represents amount of data i.e. a group of bits
that a computer can represent and work upon at any given
time.