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
Hexa-
decimal
16 0, 1, … 9,
A, B, … F
No No
Conversion Among Bases
•The possibilities:
Hexadecimal
Decimal Octal
Binary
Quick Example
25
10 = 11001
2 = 31
8 = 19
16
Base
Decimal to Decimal (just for fun)
Hexadecimal
Decimal Octal
Binary
125
10 => 5 x 10
0
= 5
2 x 10
1
= 20
1 x 10
2
= 100
125
Base
Weight
Decimal Number System
•Decimal number system has only ten (10)
digits from 0 to 9. Every number (value)
represents with 0,1,2,3,4,5,6, 7,8 and 9 in
this number system. The base of decimal
number system is 10, because it has only 10
digits.
DECIMAL TO OTHER
•Decimal Number System to Other Base
•To convert Number system from Decimal
Number System to Any Other Base is quite
easy; you have to follow just two steps:
• A) Divide the Number (Decimal Number) by the
base of target base system (in which you want to
convert the number: Binary (2), octal (8) and
Hexadecimal (16)).
•B) Write the remainder from step 1 as a Least
Signification Bit (LSB) to Step last as a Most
Significant Bit (MSB)
Decimal Number System
•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
Hexadecimal
Decimal Octal
Binary
Decimal to Binary
A) Convert the integral part of decimal to
binary equivalent
-Divide by two, keep track of the remainder
•Repeat until the decimal number has
reached zero or less than 1
B) Convert the fractional part of decimal to
binary equivalent
•Multiply the fractional decimal number by
2.
•Integral part of resultant decimal number
will be first digit of fraction binary number.
•Repeat step 1 using only fractional part of
decimal number and then step 2.
Example
•Step 2: .47
•Conversion of .47 to binary
•0.47 * 2 = 0.94, Integral part: 0 fractional part is not equal to 0 so we
copy it to next step
•0.94 * 2 = 1.88, Integral part: 1 fractional part is not equal to 0 so we
copy it to next step
•0.88 * 2 = 1.76, Integral part: 1 fractional part is not equal to 0 so we
copy it to next step
•0.76*2 = 1.52,Ingral part :1 fractional part is not equal to 0 so we
copy it to next step
•0.52*2=1.14,Integral Part:1 fractional part is not equal to 0 so we copy
it to next step
•in this case, we have 5 digits as answer and the fractional part is still
not 0 so, we stop here.
•So equivalent binary of fractional part of decimal
is .01111
•C) Combine both integral and fractional
part of binary number.
•125.47
10 = 1111101. 01111
2
Decimal to Octal
Hexadecimal
Decimal Octal
Binary
Decimal to Octal
•Technique
–Divide by 8
–Keep track of the remainder
•Repeat until the decimal number has
reached zero or less than 8
Example
•Convert decimal number 1234.16 into octal
form
Example
•16
10
•Step 1
•We multiply 0.16 by 8 and take the integer part 0.16 x 8 =
1.28 Integer part = 1 Fractional part = 0.28 As, fractional
part is not equal to 0 so we copy it to next step. Step 2
• We multiply 0.28 by 8 and take the integer part 0.28 x 8 =
2.24 Integer part = 2 Fractional part = 0.24 As, fractional
part is not equal to 0 so we copy it to next step
•. Step 3
• We multiply 0.24 by 8 and take the integer
part 0.24 x 8 = 1.92 Integer part = 1
Fractional part = 0.92 As, fractional part is
not equal to 0 so we copy it to next step.
•Step 4 ---------- We multiply 0.92 by 8 and
take the integer part 0.92 x 8 = 7.36 Integer
part = 7 Fractional part = 0.36 As, fractional
part is not equal to 0 so we copy it to next
step.
•Step 5 ---------- We multiply 0.36 by 8 and
take the integer part 0.36 x 8 = 2.88 Integer
part = 2 Fractional part = 0.88 As, fractional
part is not equal to 0 so we copy it to next
step. Step 6 ---------- We multiply 0.88 by 8
and take the integer part 0.88 x 8 ...
•in this case, we have 5 digits as answer and
the fractional part is still not 0 so, we stop
here.
•C) Combine both integral and fractional
part of binary number.
•1234.16
10=2322.12172
8
Decimal to Hexadecimal
Hexadecimal
Decimal Octal
Binary
Decimal to Hexadecimal
•Technique
–Divide by 16
–Keep track of the remainder
- Repeat until the decimal number has
reached zero or less than 16
Example
•12
10
•Step 1
•We multiply 0.12 by 16 and take the integer part 0.12x 16
= 1.92 Integer part = 1 Fractional part = 0.92 As, fractional
part is not equal to 0 so we copy it to next step. Step 2
• We multiply 0.92 by 16 and take the integer part 0.92 x 16
= 14.72 Integer part = 14-E Fractional part = 0.72 As,
fractional part is not equal to 0 so we copy it to next step
•.72*16=11.52, Integer part = 11-B Fractional part = 0.52
•.52*16=8.32, Integer part = 8, Fractional part = 0.32,……
•C) Combine both integral and fractional
part of binary number.
•1234.12
10 = 4D2.1EB8
16
Binary to Decimal
Hexadecimal
Decimal Octal
Binary
Binary to Decimal
•Technique
–Multiply each bit by 2
n
, where
n is the “weight” of the bit
–The weight is the position of
the bit, starting from 0 on the
right
–Add the results
Example
101011
2 => 1 x 2
0
= 1
1 x 2
1
= 2
0 x 2
2
= 0
1 x 2
3
= 8
0 x 2
4
= 0
1 x 2
5
= 32
43
10
Binary to Octal
Hexadecimal
Decimal Octal
Binary
Binary to Octal
•Technique
–Group bits in threes, starting
on right
–Convert to octal digits
Example
1011010111.1101101
2 =
?
8
110 110 100
6 6 4
1011010111.1101101
2 = 1327.664
8
Integral part
1 011 010 111
1 3 2 7
fractional part
Binary to Hexadecimal
Hexadecimal
Decimal Octal
Binary
Binary to Hexadecimal
•Technique
–Group bits in fours, starting
on right
–Convert to hexadecimal
digits
Example
1010111011.110001111
2 = ?
16
0010 1011 1011
2 B B
1010111011
2 = 2BB.C78
16
Integral part
fractional part
1100 0111 1000
C 7 8
Octal to Decimal
Hexadecimal
Decimal Octal
Binary
Octal to Decimal
•Technique
–Multiply each bit by 8
n
, where n
is the “weight” of the bit
–The weight is the position of the
bit, starting from 0 on the right
–Add the results
Example
724.123
8 =>4 x 8
0
= 4
2 x 8
1
= 16
7 x 8
2
= 448
468
10
123 1 x 8
-1
= 0.125
2 x 8-2 = 0.03125
3 x 8-
3
= 0.005859375
468.162109375
10
724.123
8 =>
0.162109375
Hexadecimal to Decimal
Hexadecimal
Decimal Octal
Binary
Hexadecimal to Decimal
•Technique
–Multiply each bit by 16
n
, where n is the
“weight” of the bit
–The weight is the position of the bit, starting
from 0 on the right
–Add the results
Example
ABC.1A
16 =>C x 16
0
= 12 x 1 = 12
B x 16
1
= 11 x 16 = 176
A x 16
2
= 10 x 256 = 2560
2748
10
ABC.1A
16 =>1 x 16
-1
= 0.0625
A x 16-
2
= 0.0390625
0.1015625
10
Ans. 2748.1015625
10
Octal to Binary
Hexadecimal
Decimal Octal
Binary
Octal to Binary
•Technique
–Convert each octal digit to a
3-bit equivalent binary
representation
Example
705
8 = ?
2
7 0 5
111 000 101
705
8 = 111000101
2
Hexadecimal to Binary
Hexadecimal
Decimal Octal
Binary
Hexadecimal to Binary
•Technique
–Convert each hexadecimal digit to a 4-bit
equivalent binary representation
Example
10AF
16 = ?
2
1 0 A F
0001 0000 1010 1111
10AF
16 = 0001000010101111
2
Octal to Hexadecimal
Hexadecimal
Decimal Octal
Binary
Octal to Hexadecimal
•Technique
–Use binary as an intermediary
Example
1076
8 = ?
16
1 0 7 6
001 000 111 110
2 3 E
1076
8 = 23E
16
Hexadecimal to Octal
Hexadecimal
Decimal Octal
Binary
Hexadecimal to Octal
•Technique
–Use binary as an intermediary
Common Powers (1 of 2)
•Base 10
Power Preface Symbol
10
-12
pico p
10
-9
nano n
10
-6
micro
10
-3
milli m
10
3
kilo k
10
6
mega M
10
9
giga G
10
12
tera T
Value
.000000000001
.000000001
.000001
.001
1000
1000000
1000000000
1000000000000
Common Powers (2 of 2)
•Base 2
Power Preface Symbol
2
10
kilo k
2
20
mega M
2
30
Giga G
Value
1024
1048576
1073741824
• What is the value of “k”, “M”, and “G”?
• In computing, particularly w.r.t. memory,
the base-2 interpretation generally applies
Example
/ 2
30
=
In the lab…
1. Double click on My Computer
2. Right click on C:
3. Click on Properties
Exercise – Free Space
•Determine the “free space” on all drives on
a machine