UNIT-3 Number System
3.1.Decimal,
Binary, Octal, Hexadecimal Number System & conversion
3.2.9's
and 10's complements decimal subtraction
3.3.Calculation
in Binary – addition, subtraction, One’s and Two’s Complement Methods of
binary subtraction.
|
Number
System
A way to representing a number with
specific pattern and specific base is called number system. For example: (3450)8,
(110110)2, (34FA)H etc.
Types of Number system
1) Non-positional
number system.
2) Positional number
system.
Non-positional
number system is such type of number system which is not used any types of
arithmetic calculation. For example: a
roman number system.
Positional
number system is such type of number system which is used in any types of
arithmetic calculation. For example: a Binary, Quainary, Octal, Decimal and
Hexadecimal number system etc.
Types of Positional number system
i.
Binary Number
System: -
The numbers having from 0 to 1 and base is 2 is called binary number system. It
is used in mathematical and digital system. In computer, binary 0 means
off/false/low and binary 1 means on/true/high. For example: (1100)2,
(00101)2 etc.
ii.
Quinary Number
System: -
The numbers having from 0 to 4 and base is 5 is called quinary number system.
For example: (234)5, (02303)5 etc.
iii.
Octal Number System:
-
The numbers having from 0 to7 and base is 8 is called octal number system. The
word octal is taken from Latin octo or "eight". It is used in some
programming language. For example: (2450)8, (745602)8
etc.
iv.
Decimal Number
System: -
The numbers having from 0 to 9 and base is 10 is called decimal number system. It
is used in all financial institutions and daily activities. For example: (2490)10,
(78902)10 etc.
v.
Hexadecimal Number
System: -
The numbers having from 0 to9 & A to F and base is 16 or H is called
hexadecimal number system. It is used for representing addresses of memory
locations in microprocessors and assembly language programming. For example:
(24C9)H, (745DF)16 etc.
Some Basic terms:
i.
Bit: - The bit stands for
binary digit. Each digit in a binary number system is called a bit. For example
0 or 1.
ii.
Nibble: - A group of 4-bits
is called nibble or one nibble.
iii.
Byte: - A group of 8-bits
or 2-nibbles is called Byte.
iv.
Word: -A group of 2-bytes
is called word or one word.
v.
Base: - A base is a type of
digit which represents a type of number system. It is also called radix.
Binary Arithmetic
Binary
arithmetic is essential part of all the digital computers and many other
digital systems.
Binary Addition
It is a
key for binary subtraction, multiplication, division. There are four rules of
binary addition.
In
fourth case, a binary addition is creating a sum of (1 + 1 = 10) i.e. 0 is
written in the given column and a carry of 1 over to the next column.
Example −
Addition
Binary Subtraction
Subtraction
and Borrow, these two words will be used
very frequently for the binary subtraction. There are four rules of binary
subtraction.
Example −
Subtraction
Binary Multiplication
Binary
multiplication is similar to decimal multiplication. It is simpler than decimal
multiplication because only 0s and 1s are involved. There are four rules of
binary multiplication.
Example −
Multiplication
Binary Division
Binary
division is similar to decimal division. It is called as the long division
procedure.
Example −
Division
Conversion
Decimal Number Conversion
A repeated division and remainder algorithm can convert decimal
to binary, octal, or hexadecimal.
- Divide
the decimal number by the desired target radix (2, 8, or 16).
- Append
the remainder as the next most significant digit.
- Repeat
until the decimal number has reached zero.
Decimal to Binary
Here is an example of using repeated division to convert 1792
decimal to binary:
Decimal Number
|
Operation
|
Quotient
|
Remainder
|
Binary
Result
|
|
1792
|
÷ 2 =
|
896
|
0
|
0
|
|
896
|
÷ 2 =
|
448
|
0
|
00
|
|
448
|
÷ 2 =
|
224
|
0
|
000
|
|
224
|
÷ 2 =
|
112
|
0
|
0000
|
|
112
|
÷ 2 =
|
56
|
0
|
00000
|
|
56
|
÷ 2 =
|
28
|
0
|
000000
|
|
28
|
÷ 2 =
|
14
|
0
|
0000000
|
|
14
|
÷ 2 =
|
7
|
0
|
00000000
|
|
7
|
÷ 2 =
|
3
|
1
|
100000000
|
|
3
|
÷ 2 =
|
1
|
1
|
1100000000
|
|
1
|
÷ 2 =
|
0
|
1
|
11100000000
|
|
0
|
done.
|
Decimal to Octal
Here is an example of using repeated division to convert 1792
decimal to octal:
Decimal Number
|
Operation
|
Quotient
|
Remainder
|
Octal
Result
|
|
1792
|
÷ 8 =
|
224
|
0
|
0
|
|
224
|
÷ 8 =
|
28
|
0
|
00
|
|
28
|
÷ 8 =
|
3
|
4
|
400
|
|
3
|
÷ 8 =
|
0
|
3
|
3400
|
|
0
|
done.
|
Decimal to Hexadecimal
Here is an example of using repeated division to convert 1792 decimal
to hexadecimal:
Decimal Number
|
Operation
|
Quotient
|
Remainder
|
Hexadecimal
Result
|
|
1792
|
÷ 16 =
|
112
|
0
|
0
|
|
112
|
÷ 16 =
|
7
|
0
|
00
|
|
7
|
÷ 16 =
|
0
|
7
|
700
|
|
0
|
done.
|
The only addition to the algorithm when converting from decimal
to hexadecimal is that a table must be used to obtain the hexadecimal digit if
the remainder is greater than decimal 9.
Decimal:
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
Hexadecimal:
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
Decimal:
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
Hexadecimal:
|
8
|
9
|
A
|
B
|
C
|
D
|
E
|
F
|
Hexadecimal to Binary
Converting from hexadecimal to binary is as easy as converting
from binary to hexadecimal. Simply look up each hexadecimal digit to obtain the
equivalent group of four binary digits.
Hexadecimal:
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
Binary:
|
0000
|
0001
|
0010
|
0011
|
0100
|
0101
|
0110
|
0111
|
Hexadecimal:
|
8
|
9
|
A
|
B
|
C
|
D
|
E
|
F
|
Binary:
|
1000
|
1001
|
1010
|
1011
|
1100
|
1101
|
1110
|
1111
|
Hexadecimal =
|
A
|
2
|
D
|
E
|
|
Binary =
|
1010
|
0010
|
1101
|
1110
|
= 1010001011011110
binary
|
Hexadecimal to Octal
When converting from hexadecimal to octal, it is often easier to
first convert the hexadecimal number into binary and then from binary into
octal. For example, to convert A2DE hex into octal:
(from the previous example)
Hexadecimal =
|
A
|
2
|
D
|
E
|
|
Binary =
|
1010
|
0010
|
1101
|
1110
|
= 1010001011011110 binary
|
Add leading zeros or remove leading zeros to group into sets of
three binary digits.
Binary: 1010001011011110 = 001 010 001
011 011 110
Then, look up each group in
a table:
Binary:
|
000
|
001
|
010
|
011
|
100
|
101
|
110
|
111
|
Octal:
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
Binary =
|
001
|
010
|
001
|
011
|
011
|
110
|
|
Octal =
|
1
|
2
|
1
|
3
|
3
|
6
|
= 121336 octal
|
Therefore, through a two-step conversion process, hexadecimal
A2DE equals binary 1010001011011110 equals octal 121336.
Labels: CH-3
0 Comments:
Post a Comment
thank you
Subscribe to Post Comments [Atom]
<< Home