1. Number Systems
Presented by:
Prof. Anil Khurana
Department of Management Studies
Deenbandhu Chhotu Ram University of Science & Technology, Murthal
2. Number System
Why do we need more number systems?
• Humans understand decimal
• Digital electronics (computers) understand binary
• Since computers have 32, 64, and even 128 bit busses, displaying numbers in binary is
cumbersome.
• Data on a 32 bit data bus would look like the following:
0110 1001 0111 0001 0011 0100 1100 1010
• Hexadecimal (base 16) and octal (base 8) number systems are used to represent binary data in
a more compact form.
• This presentation will present an overview of the process for converting numbers between the
decimal number system and the hexadecimal & octal number systems.
Check out my ten digits !
2
3. Converting To and From Decimal
Successive
Division
Hexadecimal16
0 1 2 3 4 5 6 7 8 9 A B C D E F
Weighted
Multiplication
Successive
Division
Weighted
Multiplication
Octal8
0 1 2 3 4 5 6 7
Successive
Division
Weighted
Multiplication
Binary2
0 1
Decimal10
0 1 2 3 4 5 6 7 8 9
3
5. Conversion: Decimal ↔ Binary
Successive
Division
a) Divide the decimal number by 2; the remainder is the LSB of the binary number.
b) If the quotation is zero, the conversion is complete. Otherwise repeat step (a) using the quotation as the
decimal number. The new remainder is the next most significant bit of the binary number.
a) Multiply each bit of the binary number by its corresponding bit-weighting factor (i.e., Bit-0→20=1; Bit-
1→21=2; Bit-2→22=4; etc).
b) Sum up all of the products in step (a) to get the decimal number.
Weighted
Multiplication
5
6. Conversion Process Decimal ↔ BaseN
(Any base including Binary2, Octal8, Hexidecimal16)
Successive
Division
a) Divide the decimal number by N; the remainder is the LSB of the ANY BASE Number .
b) If the quotient is zero, the conversion is complete. Otherwise repeat step (a) using the quotient as the
decimal number. The new remainder is the next most significant bit of the ANY BASE number.
a) Multiply each bit of the ANY BASE number by its corresponding bit-weighting factor (i.e., Bit-0→N0; Bit-
1→N1; Bit-2→N2; etc).
b) Sum up all of the products in step (a) to get the decimal number.
Weighted
Multiplication
6
7. Decimal to Binary
• Decimal numbers can be converted to binary by repeated division of
the number by 2 while recording the remainder. Let’s take an example
to see how this happens.
The remainders are to be read
from bottom to top to obtain
the binary equivalent.
4310 = 1010112
7
8. Binary to Decimal
• The Process: Weighted Multiplication
• Multiply each bit of the Binary Number by its corresponding bit-weighting factor (i.e., Bit-
0→20=1; Bit-1→21=2; Bit-2→32=8; etc.).
• Sum up all of the products in step (a) to get the decimal number.
• Example: Convert the Binary number 1101102 into its decimal equivalent.
110110 2 = 5410
Bit-Weighting
Factors
8
1 1 0 1 1 0
25 24 23 22 21 20
32 16 8 4 2 1
1 x 32 1 x 16 0 x 8 1 x 4 1 x 2 + 0 x 1
32 + 16 + 0 + 4 + 2 + 0 = 5410
9. Decimal to Octal
• Decimal numbers can be converted to octal by repeated division of
the number by 8 while recording the remainder. Let’s take an example
to see how this happens.
Reading the remainders from bottom to top,
47310 = 7318 9
10. Octal to Decimal
• The Process: Weighted Multiplication
• Multiply each bit of the Octal Number by its corresponding bit-weighting factor (i.e., Bit-
0→80=1; Bit-1→81=8; Bit-2→82=64; etc.).
• Sum up all of the products in step (a) to get the decimal number.
• Example: Convert the Octal number 1368 into its decimal equivalent.
1 3 6
82 81 80
64 8 1
64 + 24 + 6 = 9410
Bit-Weighting
Factors
136 8 = 9410
10
11. Decimal to Hexadecimal
• Decimal numbers can be converted to octal by repeated division of
the number by 16 while recording the remainder. Let’s take an
example to see how this happens.
Reading the remainders from bottom to top we get,
42310 = 1A716
11
12. Hexadecimal to Binary
• The Process: Weighted Multiplication
• Multiply each bit of the hexadecimal number by its corresponding bit-weighting factor (i.e.,
Bit-0→160=1; Bit-1→161=16; Bit-2→162=256; etc.).
• Sum up all of the products in step (a) to get the decimal number.
• Example:
• Convert the octal number 5E16 into its decimal equivalent.
5 E
161 160
16 1
80 + 14 = 9410
Bit-Weighting
Factors 5E 16 = 9410
12
13. Binary to Octal
• To convert a binary number to octal number, these
steps are followed −
• Starting from the least significant bit, make groups of
three bits.
• If there are one or two bits less in making the groups,
0s can be added after the most significant bit
• Convert each group into its equivalent octal number
• Let’s take an example to understand this.
10110010102 = 26258
13
14. Octal To Binary
• To convert an octal number to binary, each octal digit is converted to
its 3-bit binary equivalent according to this table.
Octal Digit 0 1 2 3 4 5 6 7
Binary Equivalent 000 001 010 011 100 101 110 111
546738 = 1011001101110112
14
15. Binary to Hexadecimal
• To convert a binary number to hexadecimal
number, these steps are followed −
• Starting from the least significant bit, make groups
of four bits.
• If there are one or two bits less in making the
groups, 0s can be added after the most significant
bit.
• Convert each group into its equivalent octal
number.
• Let’s take an example to understand this.
101101101012 = DB516
15
16. Hexadecimal to Binary
• To convert an hexadecimal number to binary, each hexadecimal digit
is converted to its 4-bit binary equivalent.
Octal Digit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Binary
Equivalent
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
9A4E516 = 100110100100111001012
16