Number System, Conversion, Decimal to Binary, Decimal to Octal, Decimal to Binary, Decimal to HexaDecimal, Binary to Decimal, Octal to Decimal, Hexadecimal to Decimal, Binary to Octal, Binary to Hexadecimal, Octal to Hexadecimal, BCD, Binary Addition
Hybridoma Technology ( Production , Purification , and Application )
Number System.pdf
1. 1
SWETA KUMARI BARNWAL
NUMBER SYSTEM
The language we use to communicate with each other is comprised of words and characters.
We understand numbers, characters and words. But this type of data is not suitable for
computers. Computers only understand the numbers.
So, when we enter data, the data is converted into electronic pulse. Each pulse is identified as
code and the code is converted into numeric format by ASCII. It gives each number, character
and symbol a numeric value (number) that a computer understands. So, to understand the
language of computers, one must be familiar with the number systems.
The Number Systems used in computers are:
o Binary number system
o Octal number system
o Decimal number system
o Hexadecimal number system
BASE/RADIX: The base value in a numbering system.
For example,
• In the decimal numbering system, the radix is 10.
• In the hexadecimal numbering system, the radix is 16.
• In the octal numbering system, the radix is 8.
• In the binary numbering system, the radix is 2.
Decimal (10 Symbols)
(0, 1, 2, 3…9)
Octal (8 )
(0, 1, 2, 3…7)
HexaDecimal (16 Symbols)
(0, 1, 2, 3…9, A,B,C,D,E,F)
Binary (2 Symbols)
(0 & 1)
Number System
2. 2
SWETA KUMARI BARNWAL
Bits & Bytes:
• a "bit" is atomic: the smallest unit of storage
• A bit store just a 0 or 1
• "In the computer it's all 0's and 1's" ... bits
• Anything with two separate states can store 1 bit
• In a chip: electric charge = 0/1
• In a hard drive: spots of North/South magnetism = 0/1
• A bit is too small to be much use
• Group of 8 bits together to make 1 byte
• Everything in a computer is 0's and 1's. The bit stores just a 0 or 1: it's the smallest
building block of storage.
ASCII (American Standard Code for Information Interchange)
• ASCII is an encoding representing each typed character by a number
• Each number is stored in one byte (so the number is in 0 to 255)
• A is 65
• B is 66
• a is 96
• space is 32
ASCII stands for the "American Standard Code for Information Interchange".
It was designed in the early 60's, as a standard character set for computers and electronic
devices.
ASCII is a 7-bit character set containing 128 characters.
It contains the numbers from 0-9, the upper- and lower-case English letters from A to Z, and
some special characters.
The character sets used in modern computers, in HTML, and on the Internet, are all based on
ASCII.
The following tables list the 128 ASCII characters and their equivalent number.
6. 6
SWETA KUMARI BARNWAL
Decimal to Hexadecimal
(935.126)10 → (3A7.204F)16
Hexadecimal to Decimal
(3A7.204F)16 → (935.1261)10
(2) (1) (0) (-1) (-2) (-3) (-4) Position
3 A 7 . 2 0 4 F
x x x x x x x
162 161 160 16-1 16-2 16-3 16-4
768 + 160 + 7 . (.125) + (0) + (0.0009)+(0.0002)
7. 7
SWETA KUMARI BARNWAL
Binary to/from Octal
a) Binary → Decimal → Octal
(1010101)2 → (85)10 → (125)8
(110011.110) → (51.75) → (63.6)
b) Octal → Decimal → Binary
(125) → (85) → (1010101) (1010101)
(721.25) → (465.3281) → (111010001.0101)
If no of bits = n
Number represented by that bits (N) = 2n
– 1
Ex:
Octal System (8 symbols: 0 to 7)
N = 7
N = 2n
– 1 = 7
n = 3
When we will convert Octal to Binary, we have required 3 bits for 1
digit.
Decimal to Binary
Binary to Decimal
2(n-1)
……… 22
21
20
32 16 8 4 2 1
No ABC
4 2 1
0 0 0 0
9. 9
SWETA KUMARI BARNWAL
Hexadecimal to/from Binary
a) Hexadecimal → Decimal → Binary
(A5.9D) → (165.6132) → (10100101.1001)
(FB1.C4) → (4017.7656) → (111110110001.1100)
b) Binary → Decimal → Hexadecimal
(11110011010.10110) → (1946.6875) → (79A.B0)
Hexadecimal System (16 symbols: 0 to 9 & A B C D E F)
N = 15
N = 2n
– 1 = 15
n = 4
When we will convert Octal to Binary, we have required 3 bits for 1
digit.
Decimal to Binary
Binary to Decimal
2(n-1)
……… 22
21
20
32 16 8 4 2 1
10. 10
SWETA KUMARI BARNWAL
No ABCD
8 4 2 1
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
A 1 0 1 0
B 1 0 1 1
C 1 1 0 0
D 1 1 0 1
E 1 1 1 0
F 1 1 1 1
a) Hexadecimal → Binary
(A5.9D) → (1010 0101 . 1001 1101) → (1010 0101.1001)
(FB1.C4) → (1111 1011 0001 . 1100 0100) → (1111 1011 0001.1100)
(1FB1.C4) → (0001 1111 1011 0001 . 1100 0100)
b) Binary → Hexadecimal
(0111 1001 1010 . 1011 0) → (79A.B0) → (79A.B0)
Q. How many bits are required to represent a number system having 128
symbols? (N 0 to 127)
N = 127
N = 2n
-1
n = 7
11. 11
SWETA KUMARI BARNWAL
Q. How many bits are required to represent a number system having 156
symbols?
N = 155
2n
-1 > = N
n >= 7
n = 8
Q. How many bits are required to represent a number system having 394
symbols?
2n
-1 > = N = 394
Let n = 8, condition is not true
Let n = 9, condition is true
n = 9
Ans.: 9
Q. How many symbols can be represented by using 10 bits?
Ans.: 1024
Q. Find the Maximum Number that can be represented by using 10 bits?
Ans.: 1023
Q. How many symbols can be represented by using 12 bits?
Ans.: 4096
Q. Find the Maximum Number that can be represented by using 9 bits?
Ans.: 511
Q. Hexadecimal to Binary
(BC5.982)
(A712.0056)
(5D8.234)
(98FE.BAF)
12. 12
SWETA KUMARI BARNWAL
Exercise: Binary to Hexadecimal
(110111011.111101)
(101110100.011101)
(11100011.010101)
(1010101010.1101001)
We have already Covered:
Number System & Conversion between
a) Decimal to/from (Binary, Octal & Hexadecimal)
b) Binary to/from Octal & Hexadecimal
OCTAL TO/FROM HEXADECIMAL
Octal → Binary → Hexadecimal
(27.65)8 → (00010 111 . 110 10100) → (17.D4)16
(7765.6271)8 → (111 111 110 101 . 110 010 111 001) → (F F 5. C B 9)
B (11) (8421) (1011)
Hexadecimal → Binary → Octal
(FD90.5C7) → (001111 1101 1001 0000 . 0101 1100 0111) → (176620.2707)8
Ex:
(12FD.97C) (9532.4471) (10DE4.10B) (7AB.F9EB)
(710.554) (5517.346) (7712.354) (1275.2606)
BCD (Binary Coded Decimal)
Another process for converting decimal numbers into their binary equivalents.
• It is a form of binary encoding where each digit in a decimal number is represented
in the form of bits.
• This encoding can be done in either 4-bit or 8-bit (usually 4-bit is preferred).
13. 13
SWETA KUMARI BARNWAL
• It is a fast and efficient system that converts the decimal numbers into binary
numbers as compared to the existing binary system.
• These are generally used in digital displays where is the manipulation of data is
quite a task.
• Thus, BCD plays an important role here because the manipulation is done treating
each digit as a separate single sub-circuit.
In the BCD numbering system, the given decimal number is segregated into chunks of four
bits for each decimal digit within the number. Each decimal digit is converted into its direct
binary form (usually represented in 4-bits).
DECIMAL NUMBER BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
(852.371)10 → (1000 0101 0010 . 0011 0111 0001)BCD
8 → 1000
5 → 0101
2 → 0010
3 → 0011
7 → 0111
1 → 0001
22. 22
SWETA KUMARI BARNWAL
54 → 110110 (00110110) (1101 0110)
129 → 10000001
37 →
0 00100101 000100101
-37 →
1 00100101 100100101
453 → 111000101 → 0000000111000101
0 0000000111000101 00000000111000101
-453
1 0000000111000101 10000000111000101
Ex: (HW)
Write these numbers in 1’s, 2’s Compliment & Sign Representation
a) 137 & -137
b) 98 & -98
c) 266 & -266
d) 32 & -32
e) 78 & -78
The given binary no is in sign representation. Find the magnitude & Sign.
a) 1 1001 = (-9)
23. 23
SWETA KUMARI BARNWAL
b) 0 1101 (+13)
c) 0 00111010 (+58)
d) 1 00111111 (-63)
e) 1 11111111 (-255)
The given binary no (10010) is in sign representation. Find the magnitude
& Sign.
Ans: (-2)
Overflow:
1111
+1111
11110
10111
0111
11110
2n
→ No of symbols
2n
-1 → Maximum no represented by n bits.
n → bits number
n = 1
No of symbols = 21
= 2 ( 0, 1)
Maximum no represented by 1 bits = 21
-1 = 1
n = 2
No of symbols = 22
= 4 ( 00, 01,10, 11)
Maximum no represented by 2 bits = 22
-1 = 3
n = 5
No of symbols = 25
= 32 ( 00000, 00001, 00010……… 11111)
Maximum no represented by 5 bits = 25
-1 = 31