Number system
tosinrogue!! A blogger
Number System
Number System
Number system: It is an organized and systematic way of representing
number.
Bit, Byte, Word and Character
•
A bit is the smallest quantity of
information that can be stored or manipulated in a computer system. Digital
computer store information in form of “1” or “0” at a defined memory location
or address.
A single binary digit is known as a bit. It is the
smallest unit of information.
•
A byte is a group of eight bits.
–
Byte = 8 bits
•
A word is a contiguous group of
bytes. A word means the basic unit of information operated on by a computer.
Usually a word represents a number or instruction
Typical word sizes: 4, 8,
16, 32, 64, 128 bits
1K = 1024 bytes
- Characters
are alphanumeric (A-Z, a-z,0-9) and symbols (*,-,+,! Etc.) which are
assigned binary patterns so that they can be stored and manipulated within
the computer system.
Types of Number System
1. Decimal number system: It is number system with base 10 and use
digits 0 to 9 (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9).It can be written as subscripted 10.For example: 16710.
2. Binary system: The prefix “bi-” stands for 2. The binary number system is a Base 2 number system: There are 2 symbols that represent quantities: 0, 1.
2. Binary system: The prefix “bi-” stands for 2. The binary number system is a Base 2 number system: There are 2 symbols that represent quantities: 0, 1.
3. Octal number system: It is a number system with base 8 and uses
digits 0 to 7.It can be written as subscripted 8.For example: 17898.
4. Hexadecimal Number system: It is a number system with base 16 and use digits 0 to 9 and alphabet A to F. It can be written as subscripted 16. For example: (ABC)16
4. Hexadecimal Number system: It is a number system with base 16 and use digits 0 to 9 and alphabet A to F. It can be written as subscripted 16. For example: (ABC)16
Decimal
|
Binary
|
Octal
|
Hexadecimal
|
0
|
0000
|
0
|
0
|
1
|
0001
|
1
|
1
|
2
|
0010
|
2
|
2
|
3
|
0011
|
3
|
3
|
4
|
0100
|
4
|
4
|
5
|
0101
|
5
|
5
|
6
|
0110
|
6
|
6
|
7
|
0111
|
7
|
7
|
8
|
1000
|
8
|
|
9
|
1001
|
9
|
|
10
|
1010
|
A
|
|
11
|
1011
|
B
|
|
12
|
1100
|
C
|
|
13
|
1101
|
D
|
|
14
|
1110
|
E
|
|
15
|
1111
|
F
|
CONVERT BINARY TO DECIMAL
11002
= (1 x 23 ) + ( 1 x 22 )+ ( 0 x 21 )+ ( 0 x 20
)
= 8
+ 4 +
0 + 0
= 1210
100012
= (1 x 24) + ( 0 x 23 )+ ( 0 x 22 )+ ( 0
x 21 )+ ( 1 x 20 )
= 16
+ 0 +
0 + 0
+ 1
= 1710
1010112=
(1 x 25) + (0 x 24) + ( 1 x 23 )+ ( 0 x 22
)+ ( 1 x 21 )+ ( 1 x 20 )
= 32
+ 0 +
8 + 0
+ 2 +
1
= 4310
1111012=
(1 x 25) + (1 x 24) + ( 1 x 23 )+ ( 1 x 22
)+ ( 0 x 21 )+ ( 1 x 20 )
= 32
+ 16 +
8 + 4
+ 0 +
1
= 6110
1102 = 610
10102 = 1010
1100002
= 4810
111112 = 3110
CONVERT DECIMAL TO BINARY
211
|
210
|
29
|
28
|
27
|
26
|
25
|
24
|
23
|
22
|
21
|
20
|
||
2048
|
1024
|
512
|
256
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
||
710 =
|
1
|
1
|
1
|
= 1112
|
|||||||||
3410 =
|
1
|
0
|
0
|
0
|
1
|
0
|
= 1000102
|
||||||
8910 =
|
1
|
0
|
1
|
1
|
0
|
0
|
1
|
= 10110012
|
|||||
20310 =
|
1
|
1
|
0
|
0
|
1
|
0
|
1
|
1
|
= 110010112
|
||||
1910 =
|
1
|
0
|
0
|
1
|
1
|
= 100112
|
|||||||
2210 =
|
1
|
0
|
1
|
1
|
0
|
= 101102
|
|||||||
1510 =
|
1
|
1
|
1
|
1
|
= 11112
|
||||||||
3610 =
|
1
|
0
|
0
|
1
|
0
|
0
|
= 1001002
|
||||||
4810 =
|
1
|
1
|
0
|
0
|
0
|
0
|
= 1100002
|
||||||
3910 =
|
1
|
0
|
0
|
1
|
1
|
1
|
= 1001112
|
||||||
6410 =
|
1
|
0
|
0
|
0
|
0
|
0
|
0
|
= 10000002
|
|||||
10310 =
|
1
|
1
|
0
|
0
|
1
|
1
|
1
|
= 11001112
|
EXAMPLE: 710
= 1112
because 7- 4 = 3 3 – 2 = 1 1 - 1= 0
Or
12510 =?2
2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0
1
12510 = 11111012
|
710 =?2
2 7
2 3 1
2 1 1
0 1
710 =1112
|
8910
=
2 89
2 44 1
2 22 0
2 11 0
2 5 1
2 2 1
2 1 0
0 1
8910 = 10110012
|
Converting From Base-8 to
Base-10 (Octal - Decimal)
1118 = 1*82+1*81+1*80 =
64+8+1 = 7310
438 = 4*81+3*80 = 32+3 = 3510
61238 = 6*83+1*82+2*81+3*80 =
3072+64+16+3 = 315510
Binary --> octal
1. Group into 3's starting at
least significant symbol (if the number
of bits is not evenly divisible by 3, then add 0's at the most significant end)
2. Write 1 octal digit for
each group
Example:
100 010 111 (binary)
4
2 7 (octal)
10 101 110
(binary)
2
5 6 (octal)
Binary --> hex
1. Group into 4's starting at least significant symbol
(If the number of bits is not evenly divisible by 4, then add 0's at the most significant end)
2. Write 1 hex digit for each group
Examples:
1001 1110 0111 0000
9 e 7 0
1 1111 1010 0011
1 f a 3
hex --> binary
just write down the 4 bit binary code for each hexadecimal digit
example:
3 9 c 8
0011 1001 1100 1000
octal --> binary
just write down the 8 bit binary code for each octal digit
example:
5 0 1
101 000 001
hex --> octal
do it in 2 steps, 1. hex --> binary
2. binary --> octal
HEXADECIMAL NUMBER
SYSTEM
Hexadecimal
number system is Base Sixteen
Number of symbols = 16.
Symbols 0,1,2,3,4,5,6,7,8,9, A, B,
C, D, E, F
1611
|
1610
|
169
|
168
|
167
|
166
|
165
|
164
|
163
|
162
|
161
|
160
|
16,777,216
|
1,048,576
|
65,536
|
4,096
|
256
|
16
|
1
|
We
use hexadecimal numbers as “shorthand” for binary numbers
•
Each group of four binary digits can be represented by a single hexadecimal
digit.
CONVERT HEXADECIMAL TO DECIMAL
7216 = (7 x 161 ) + ( 2 x 160 )
= 112
+ 2
= 11410
235916
= ( 2 x 163 )+ ( 3 x 162 )+ ( 5 x 161 )+ ( 9 x
160 )
=
8192 + 768
+ 80 +
9
= 904910
C2916
= ( C x 162 )+ ( 2 x 161 )+ ( 9 x 160 )
=
3072 + 32
+ 9
= 311310
12AB16
= ( 1 x 163 )+ ( 2 x 162 )+ ( 10 x 161 )+ ( 11
x 160 )
=
4096 + 512
+ 160 +
11
= 477910
3AC216
= ( 3 x 163 )+ ( 10 x 162 )+ ( 12 x 161 )+ ( 2
x 160 )
=
12288 + 2560
+ 192 +
2
= 1504210
CONVERT DECIMAL TO HEXADECIMAL
Allowable
symbols 0, 1, 2, 3, 4,5, 6, 7, 8,
9, A,
B, C, D,
E, F
166
|
165
|
164
|
163
|
162
|
161
|
160
|
||
16,777,216
|
1,048,576
|
65,536
|
4096
|
256
|
16
|
1
|
||
67210 =
|
2
|
A
|
0
|
= 2A016
|
||||
1,76310 =
|
6
|
E
|
3
|
= 6E316
|
||||
1,32410 =
|
5
|
2
|
C
|
= 52C16
|
||||
43,98110 =
|
A
|
B
|
C
|
D
|
= ABCD16
|
|||
993,85110
=
|
F
|
2
|
A
|
3
|
B
|
= F2A3B16
|
||
12,76010 =
|
3
|
1
|
D
|
8
|
= 31D816
|
For
example:
672
1763
2 @ 256 -512 6 @ 256 -1536
160 227
10 @ 16 -160 14 @ 16 -224
0 3
2A016 6E316
1324
43,981
5 @ 256 -1280 10 @ 4096
- 40,960
44 3021
2 @ 16 -
32
11 @ 256 - 2816
12
205
52C16 12 @ 16 -192
13
ABCD16
Binary to Hexadecimal
1010 11002 1110
1001 2
0110 1011 2 0100 1100
10 12 14 9
6 11 4 12
A
C
E 9 6 B 4 C
AC16
E916 6B16
4C16
Hexadecimal to Binary
83h 57h 21h ABh
1000 0011b 0101 0111b 0010 0001b 1010
1011b
3Ch
4Fh
DBh EEh
0011 1100b 0100 1111b
1101 1011b 1110 1110b
0011 1111b 0001 1000b 0101 1010b 1101
0111
3 15 1 8
5 10 13 7
3
F
1 8 5 A D 7
3Fh
18h
5Ah D7h
Convert
A3D7 to binary.
•
A 3 D 7
• 1010 0011 1101 0111
Character Representation:
ASCII
n Alphanumeric data such as names and addresses
are represented as strings of characters containing letters, numbers and
symbols.
n Each character has a unique code or sequence
of bits to represent it. As each
character is entered from a keyboard it must be converted into its binary code.
n Character code sets contain two types of
characters:
•
Printable
(normal characters)
•
Non-printable,
i.e. characters used as control codes. For example:
–
CTRL
G (beep)
–
CTRL
Z (end of file)
n ASCII :American Standard Code for Information
Interexchange
•
strictly
speaking a 7-bit code (128 characters)
•
has
an extended 8-bit version
•
used
on PC’s and non-IBM mainframes
•
widely
used to transfer data from one computer to another
•
codes
0 to 31 are control codes
An ASCII subset
Symbol Code
A 41
B
42
C
43
D
44
E
45
F
46
0
30
1
31
2
32
3
33
4
34
5
35
6
36
7
37
“BAD” = 42414416
= 0100 0010 0100 0001 0100 01002
“F1” = 463116
=
0100 0110 0011 00012
“3415” = 3334313516
= 0011
0011 0011 0100 0011 0001
0011 01012
Note that this is a text
string and no arithmetic may be done on it.
Comments
Post a Comment