NUMBER‐BASE CONVERSIONS
Number Systems
A number system is defined as a system of writing for
expressing numbers. It is the mathematical notation for
representing numbers of a given set by using digits or other
symbols in a consistent manner.
Decimal Number System
• Uses 10 digits from 0 to 9= { 0, 1, 2, 3, …, 9 }
• Example-35,64,135,2345 etc
Binary Number System
• Uses two digits, 0 and 1.
• Also called base 2 number system
• Example-100,011,101,1100,10 etc
2
Number Systems
Octal Number System:
• Uses eight digits, 0,1,2,3,4,5,6,7.
• Also called base 8 number system
• Example-35,64 ,71,135 etc
Hexadecimal Number System:
• Uses 10 digits and 6 letters, 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
• Letters represents numbers starting from 10.
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
• Also called base 16 number system.
• Example-135,782,18D,6FC etc
3
Decimal Number System
Decimal number system, symbols = { 0, 1, 2, 3, …, 9 }
Example:(7594)10 = (7x103) + (5x102) + (9x101) + (4x100)
A decimal number such as 7,594 represents a quantity equal to 7
thousands, plus 5 hundreds, plus 9 tens, plus 4 units. The thousands,
hundreds, etc., are powers of 10 implied by the position of the
coefficients (symbols) in the number.
In general, (anan-1… a0)10 = (an x 10n) + (an-1 x 10n-1) + … + (a0 x
100)
(2.75)10 = (2 x 100) + (7 x 10-1) + (5 x 10-2)
In general, (anan-1… a0 . f1f2 … fm)10 = (an x 10n) + (an-1x10n-1) + …
0 -1 -2 -m
NUMBER‐BASE CONVERSIONS
• Representations of a number in a different radix are said to be equivalent if they
have the same decimal representation. For example, (0011)8 and (1001)2 are
equivalent—both have decimal value 9.
• The conversion of a number in base r to decimal is done by expanding the
number in a power series and adding all the terms as shown previously.
• We now present a general procedure for the reverse operation of converting a
decimal number to a number in base r.
• If the number includes a radix point, it is necessary to separate the number into
an integer part and a fraction part, since each part must be converted differently.
• The conversion of a decimal integer to a number in base r is done by dividing the
number and all successive quotients by r and accumulating the remainders.
Conversion between Decimal and other
Bases
Decimal to base-R
whole numbers: repeated division-by-R
fractions: repeated multiplication-by-R
Base-2 Base-2
Base-8 Base-8
Base-16 Decimal Base-16
… ….
Base-R Base-R
6
Decimal-to-Binary Conversion
Repeated Division-by-2 Method (for
whole numbers)
Repeated Multiplication-by-2 Method
(for fractions)
7
Repeated Division-by-2 Method
To convert a whole
number to binary, use
successive division by 2 2 43
until the quotient is 0. 2 21 rem 1 LSB
The remainders form the 2 10 rem 1
2 5 rem 0
answer, with the first 2 2 rem 1
remainder as the least 2 1 rem 0
significant bit (LSB) and 0 rem 1 MSB
the last as the most
significant bit (MSB).
(43)10 = (101011)2
8
Decimal to Binary Conversion
Divide by 2 Process
Decimal # 13 ÷ 2 = 6 remainder 1
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
Divide-by-2 Process 1 ÷ 2 = 0 remainder 1
Stops When
Quotient Reaches 0
1 1 0 1
9
Repeated Multiplication-by-2
Method
To convert decimal fractions to binary,
repeated multiplication by 2 is used.
The process is continued until the Coefficient
fraction becomes 0 or until the number
of digits has sufficient accuracy.
The coefficients of the binary number
are obtained from the integers as
follows: The first integer is written as
the MSB, and the last as the LSB.
(0.3125)10 = (.0101)2
10
Decimal-to-Binary Conversion
Convert to Binary
Decimal to Binary Conversion of 17.65
(17.65)10 = (10001.10100)2
Practice
Convert the following decimal
numbers into binary:
Decimal (11)10 =(1011)2
Decimal (4)10 = (0100)2
Decimal (17)10 = (10001)2
13
Binary to Decimal Conversion
Place Value
• Example - Place value in binary system:
23 22 21 20
Place Value 8 4 2 1
Binary Number 1 1 0 0
RESULT: (1100)2 = decimal 8 + 4 + 0 + 0 = (12)10
15
Binary to Decimal
Conversion
Convert Binary Number 110011
to a Decimal Number:
25 24 23 22 21 20
Binary 1 1 0 0 1 1
Decimal 32 + 16 + 0 + 0 + 2 + 1 = 51
16
Hexadecimal Number System
Uses 16 symbols - Base 16 System
0-9, A, B, C, D, E, F
Decimal Binary Hexadecimal
1 0001 1
9 1001 9
10 1010 A
15 1111 F
16 10000 10
19
Decimal to Hexadecimal Conversion
Divide by 16 Process
Decimal # 47 ÷ 16 = 2 remainder 15
Divide-by-16 Process
Stops When 2 ÷ 16 = 0 remainder 2
Quotient Reaches 0
2 F
Digital Electronics by Parag P. 20
Hexadecimal to Decimal Conversion
Convert hexadecimal number 2DB
to a decimal number
256 16 1
Place Value
162 161 160
Hexadecimal 2 D B
(256 x 2) (16 x 13) (1 x 11)
Decimal 512 + 208 + 11 = 731
22
Practice
Convert Hexadecimal number A6 to Binary
A6 = 1010 0110 (Binary)
Convert Hexadecimal number 16 to Decimal
16 = 22 (Decimal)
Convert Decimal 63 to Hexadecimal
63 = 3F (Hexadecimal)
24
Octal Numbers
Uses 8 symbols - Base 8 System
0, 1, 2, 3, 4, 5, 6, 7
Decimal Binary Octal
1 001 1
6 110 6
7 111 7
8 001 000 10
9 001 001 11
26
Octal Decimal conversion
Decimal to Octal Conversion
Binary-Octal/Hexadecimal Conversion
Binary Octal: Partition in groups of 3
(10 111 011 001 . 101 110)2 = (2731.56)8
Octal Binary: reverse
(2731.56)8 = (10 111 011 001 . 101 110)2
Binary Hexadecimal: Partition in groups of 4
(101 1101 1001 . 1011 1000)2 = (5D9.B8)16
Hexadecimal Binary: reverse
(5D9.B8)16 = (101 1101 1001 . 1011 1000)2
29
Hexadecimal and Binary
Conversions
• Hexadecimal to Binary Conversion
Hexadecimal C 3
Binary 1100 0011
• Binary to Hexadecimal Conversion
Binary 1110 1010
Hexadecimal E A
30
Binary-Octal/Hexadecimal Conversion
Base-R to Decimal Conversion
(1101.101)2 = 123 + 122 + 120 + 12-1 + 12-3
= 8 + 4 + 1 + 0.5 + 0.125
= (13.625)10
(572.6)8 = 582 + 781 + 280 + 68-1
= 320 + 56 + 2 + 0.75 = (378.75)10
(2A.8)16 = 2161 + 10160 + 816-1
= 32 + 10 + 0.5 = (42.5)10
(341.24)5 = 352 + 451 + 150 + 25-1 + 45-2
= 75 + 20 + 1 + 0.4 + 0.16 = (96.56)10
32
Numbers with Different Bases