Number Systems
description
Transcript of Number Systems
Demo CSE Introduction to Number System By : RK Khatri
Introduction
to
Number Systems
Demo CSE Introduction to Number System By : RK Khatri
Outlines
• Introduction• Common number systems.• Counting• Conversions• Binary to Other number systems• Others to Binary number system• Decimal to Other number systems• Others to Decimal number system• Octal to Hexadecimal number system• Hexadecimal to Octal number system
Demo CSE Introduction to Number System By : RK Khatri
INTRODUCION• We are familiar with the decimal number system in which digits are 0, 1,
2, 3, 4, 5, 6, 7, 8 and 9.We use these numbers in and as phone number, age, score, weight, etc.
• The computer uses binary digits for its operation. Binary means 2. • In the binary system, there are only two digits 0 and 1. • How Computer works? The programmer or user feeds instruction and
data in alphabets and decimal digits through the keyboard. These are converted to binary bits. Final result is again converted back to monitor in human readable form.
• Other number systems are Octal n Hexadecimals.Octal means 8 and hexadecimals means 16.Octal n hexadecimals are used in Computers internal processes.
Demo CSE Introduction to Number System By : RK Khatri
Common Number Systems
System Base Symbols
Used by humans?
Used in computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
(In place of Hex)
Hexa-decimal
16 0, 1, … 9,
A, B, … F
No No
(Coding, color
coding, registry)
Demo CSE Introduction to Number System By : RK Khatri
Quantities/Counting (1 of 3)
Decimal Binary Octal
Hexa-decimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7p. 33
Demo CSE Introduction to Number System By : RK Khatri
Quantities/Counting (2 of 3)
Decimal Binary Octal
Hexa-decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Demo CSE Introduction to Number System By : RK Khatri
Quantities/Counting (3 of 3)
Decimal Binary Octal
Hexa-decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17 Etc.
Demo CSE Introduction to Number System By : RK Khatri
Quantities/Counting (3 of 3)
Decimal Binary Octal
Hexa-decimal
24 10000 30 18
25 10001 31 19
26 10010 32 1A
27 10011 33 1B
28 10100 34 1C
29 10101 35 1D
30 10110 36 1E
31 10111 37 1F
32 11000 40 20 Etc.
Demo CSE Introduction to Number System By : RK Khatri
Conversion Among Bases
• The possibilities:
Hexadecimal
Decimal Octal
Binary
Demo CSE Introduction to Number System By : RK Khatri
Quick Example
2510 = 110012 = 318 = 1916
Base
Demo CSE Introduction to Number System By : RK Khatri
Binary to Others
• 110112 = ?10 = Sum of (bit x 2 weight )… weight = position of the bit from right.
1x24 + 1x23 + 0x22 + 1x21 + 1x20 = 27
• 110112 = ?8 = Make pairs of 3 bits.011 011 = 33
• 110112 = ?16 = Make pairs of 4 bits.0001 1011 = 1 B
Demo CSE Introduction to Number System By : RK Khatri
Others to Binary• 2710 = ?2 = Divide by 2… read remainders in reverse !! 2 | 27
2 |13 | 12 |6 | 12 |3 | 02 |1 | 1 | 1
= 11011
• 338 = ?2 = Convert in pairs of 3 bits.011 011
• 1B16 = ?2 = Convert in pairs of 4 bits.0001 1011
Demo CSE Introduction to Number System By : RK Khatri
Decimal to Others• 2710 = ?2 = Divide by 2… read remainders in reverse !! 2 | 27
2 |13 | 12 |6 | 12 |3 | 02 |1 | 1 | 1
= 11011
• 27710 = ?8 = Divide by 8… read remainders in reverse !! 8 | 277
8 |34 | 58 |4 | 2 | | 4
= 425
Demo CSE Introduction to Number System By : RK Khatri
Decimal to Others• 27710 = ?16 = Divide by 16… read remainders in reverse !! 16 |277
16 |17 | 516 |1 | 1 | | 1
= 115
Demo CSE Introduction to Number System By : RK Khatri
Others to Decimal
• 110112 = ?10 = Sum of (bit x 2 weight )… weight = position of the bit from right.
1x24 + 1x23 + 0x22 + 1x21 + 1x20 = 27• 1238 = ?10 = Sum of (bit x 8 weight )…
weight = position of the bit from right.1x82 + 2x81 + 3x80 = 83• 3B16 = ?10 = Sum of (bit x 16 weight )…
weight = position of the bit from right.3x161 + 11x160 = 59
Demo CSE Introduction to Number System By : RK Khatri
Octal to Hexadecimal
• Use binary as an intermediaryOctal > Binary > Hexadecimal
10768 = ?16
1 0 7 6
001 000 111 110
2 3 E
10768 = 23E16
Demo CSE Introduction to Number System By : RK Khatri
Hexadecimal to Octal
• Use binary as an intermediaryHexadecimal > Binary > Octal
23E16 = ?8
2 3 E
0010 0011 1110
1 0 7 6
23E16 = 10768
Demo CSE Introduction to Number System By : RK Khatri
Exercise – Convert ...
Don’t use a calculator!
Decimal Binary Octal
Hexa-decimal
33
1110101
703
1AF
Skip answer Answer
Demo CSE Introduction to Number System By : RK Khatri
Exercise – Convert …
Decimal Binary Octal
Hexa-decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
Answer
Demo CSE Introduction to Number System By : RK Khatri
Fractions
• Binary to decimal
pp. 46-50
10.1011 => 1 x 2-4 = 0.06251 x 2-3 = 0.1250 x 2-2 = 0.01 x 2-1 = 0.50 x 20 = 0.01 x 21 = 2.0 2.6875
Demo CSE Introduction to Number System By : RK Khatri
Fractions
• Decimal to binary
p. 50
3.14579
.14579x 20.29158x 20.58316x 21.16632x 20.33264x 20.66528x 21.33056
etc.11.001001...
Demo CSE Introduction to Number System By : RK Khatri
Exercise – Convert ...
Don’t use a calculator!
Decimal Binary Octal
Hexa-decimal
29.8
101.1101
3.07
C.82
Skip answer Answer
Demo CSE Introduction to Number System By : RK Khatri
Exercise – Convert …
Decimal Binary Octal
Hexa-decimal
29.8 11101.110011… 35.63… 1D.CC…
5.8125 101.1101 5.64 5.D
3.109375 11.000111 3.07 3.1C
12.5078125 1100.10000010 14.404 C.82
Answer
Demo CSE Introduction to Number System By : RK Khatri
Thank you