Number Systems
Conversion Among Bases (Fraction)
• The possibilities: 12
Hexadecimal
Decimal Octal
Binary
Decimal to Other Three (Base =2, 8, 16, etc.)
Technique
• Multiply the fraction with the base and Accumulate the Integers
• If fraction is zero --- stop
• If fraction is not zero after many multiplication, If the digits are repeating,
Use bar notation
If the digits are not repeating and non-terminating, Mention digits based on accuracy
After completion-
• First integer is MSB in fraction
• Last integer is LSB in fraction
Decimal to Other Three (Base =2, 8, 16)
(0.625)
10= (?)
2= (?)
8= (?)
16Integer
0.625*2 = 1.250 1 MSB
0.25*2 = 0.5 0
0.5*2 = 1.0 1 LSB
(0.625)10 = (0.101)2
In this example, the fraction becomes zero.
Decimal to Other Three (Base =2, 8, 16)
(0.479)10 = (?)8
Integer
0.479*8 = 3.832 3 MSD
0.832*8 = 6.656 6 0.656*8 = 5.248 5 0.248*8 = 1.984 1
….….
(0.479)10 = (0.3651…)8
In this example, the fraction is non-terminating and non- repeating .
Decimal to Other Three (Base =2, 8, 16)
(0.479)10 = (?)16
Integer
0.479*16 = 7.664 7 MSD
0.664*16 = 10.624 10(A) 0.624*16 = 9.984 9
0.984*16 = 15.744 15(F)
….….
(0.479)10 = (0.7A9F…)16
In this example, the fraction is non-terminating and non- repeating .
Decimal to Binary
𝐴 = 0.000110011
(0.1)10 = (?)2
In this example, fraction is non-terminating and repeating .
Other (Base =2, 8, 16 etc.) to Decimal
• Technique
– Multiply each bit by (base) -m, where m is the “weight” of the fraction bit
– The weight is the position of the fraction bit (after point), starting from -1 and decreasing on the right
– Add the partial results
Other (Base =2, 8, 16) to Decimal
(0.10101)
2=1 x 2
-1= 0.5 0 x 2
-2= 0.0
1 x 2
-3= 0.125 0 x 2
-4= 0.0
1 x 2
-5= 0.03125
= (0.65625)
10Other (Base =2, 8, 16) to Decimal
(0.703)
8= 7 x 8
-1= 0.875 0 x 8
-2= 0.0
3 x 8
-3= 0.005859375
=(0.880859375)
10Other (Base =2, 8, 16) to Decimal
(0.F21)16 = 15 x 16-1 = 0.9375
2 x 16-2 = 0.0078125
1 x 16-3 = 0.000244140625
= (0.944869140625)10
Octal to Binary (Fraction)
Hexadecimal
Decimal Octal
Binary
Octal to Binary
•Technique
Replace each octal digit by a 3-bit binary equivalent representation.
OR Convert to decimal number
Convert decimal number to binary.
Example:
(657.137)8 =(110 101 111 . 001 011 111)2
Binary to Octal
Hexadecimal
Decimal Octal
Binary
Binary to Octal
Technique
➢Group bits in threes
For integer, form groups from right to left For Fraction, form groups from left to right
➢Replace each group by its corresponding octal digit
Example:
(10101.11011)2 = (010 101.110110)2
= (25.66)8
Hexadecimal to Binary
Hexadecimal
Decimal Octal
Binary
Hexadecimal to Binary
•Technique
Replace each hexadecimal digit by a 4-bit binary equivalent representation OR
Convert to decimal number
Convert decimal number to binary
Example:
(AB5.1A3)16 =(1010 1011 0101 . 0001 1010 0011)2
Binary to Hexadecimal
Hexadecimal
Decimal Octal
Binary
Binary to Hexadecimal
Technique
➢ Form groups consisting of four bits
• For integer, form groups from right to left
• For Fraction, make groups from left to right
➢ Convert each group of four bits by its corresponding hexadecimal digits
Example:
(10101.11011)2 = (0001 0101.11011000)2
= (15.D8)16
Octal to Hexadecimal
Hexadecimal
Decimal Octal
Binary
Octal to Hexadecimal
Technique
Use binary as an intermediary Octal to Binary
Binary to Hexadecimal Example-
(657.137)8 = (110 101 111 . 001 011 111)2
= (110101111 .001011111)2
= (0001 1010 1111 .0010 1111 1000)2
= (1A F .2F8)16
Hexadecimal to Octal
Hexadecimal
Decimal Octal
Binary
Hexadecimal to Octal
•Technique
Use binary as an intermediary Hexadecimal to Binary Binary to Octal
Example-
(6A57.1B37)16 = (0110 1010 0101 0111 . 0001 1011 0011 0111)2
= (0110101001010111. 0001101100110111)2
= (0 110 101001 010 111. 000 110 110011011 100)2
= (6 5 1 2 7 . 0 6 6 3 3 4)
8Exercise – Integer + Fraction
Decimal Binary Octal Hexadecimal 29.8
101.1101
3.07
C.82
Problem
Exercise – Convert …
Decimal Binary Octal Hexadecimal 29.8 11101.110011… 35.63… 1D.CC…
101.1101
3.07
C.82
Answer
Exercise – Convert …
Decimal Binary Octal
Hexadecimal
29.8 11101.110011… 35.63… 1D.CC…
5.8125 101.1101 5.64 5.D
3.07
C.82
Answer
Exercise – Convert …
Decimal Binary Octal
Hexadecimal
29.8 11101.110011… 35.63… 1D.CC…
5.8125 101.1101 5.64 5.D
3.109375 11.000111 3.07 3.1C C.82
Answer
Exercise – Convert …
Decimal Binary Octal Hexadecimal 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