0% found this document useful (0 votes)
12 views3 pages

Examples Chapter 1

This document provides examples and explanations for converting between different numeric bases, including: 1) Decimal to binary and binary to decimal. 2) Decimal to binary for fractional values. 3) Converting a fraction to a binary of a specified number of bits. 4) Converting between binary, octal, and hexadecimal. 5) Converting integer and fractional decimal values to hexadecimal.

Uploaded by

tabkhat.3alsari3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Examples Chapter 1

This document provides examples and explanations for converting between different numeric bases, including: 1) Decimal to binary and binary to decimal. 2) Decimal to binary for fractional values. 3) Converting a fraction to a binary of a specified number of bits. 4) Converting between binary, octal, and hexadecimal. 5) Converting integer and fractional decimal values to hexadecimal.

Uploaded by

tabkhat.3alsari3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Decimal to Binary conversion

Examples

1 2

Example Example
Convert the binary number 10011 to decimal. Convert the decimal number 35 to binary.
Solution Solution
Write out the bits and their weights. Multiply the bit by Number /2 Remainder

its corresponding weight and record the result. At the 35 17 1


17 8 1
end, add the results to get the decimal number.
8 4 0

Binary 1 0 0 1 1 4 2 0

Weights 16 8 4 2 1 2 1
/2
0
/2
1
-------------------------------------
16 + 0 + 0 + 2 + 1
Decimal 19 Binary 1 0 0 0 1 1

3 4

Example
Exercise
Transform the fraction 0.4 to a binary of 6 bits.
Solution Convert (28.8625)10 to binary -- the fractional part is coded on 8 bits
We will start with factional part:
Multiply the number continuously by 2 and • 0.8625*2= 1.725= 1 + 0.725
extract the integer part as the binary digit. You • 0.725*2= 1.45 = 1 + 0.45

can never get the exact binary representation. • 0.45*2= 0.9 = 0 + 0.9
• 0.9*2= 1.8= 1+ 0.8
Stop when you have 6 bits. • 0.8*2= 1.6= 1+ 0.6
• 0.6*2= 1.2 = 1+ 0.2
• 0.2*2= 0.4 = 0+ 0.4
0.4 è 0.8 è 1.6 è 1.2 è 0.4 è 0.8 è 1.6 • 0.4*2= 0.8 = 0 + 0.8

0 . 0 1 1 0 0 1

5 6

1
Ex: Converting Binary to Octal

• We will convert the integer part now:


(28)10 = (11100) 2 • Mark groups of three (from right)
• Convert each group
• Finally the conversion is:
• (28.8625)10 = (11100. 11011100 … )2 10101011 10 101 011
2 5 3

10101011 is 253 in base 8

17

7 8

Ex: Converting Binary to Hexadecimal

• Mark groups of four (from right)


• Convert each group

10101011 1010 1011


A B

10101011 is AB in base 16

18

9 11

Octal to Decimal conv Hexadecimal to Decimal conv

What is the decimal equivalent of the octal What is the decimal equivalent of the
number 642? hexadecimal number DEF?

2 x 8º = 2 x 1 = 2 F x 16º = 15 x 1 = 15
+ 4 x 81 = 4 x 8 = 32 + E x 161 = 14 x 16 = 224
+ 6 x 82 = 6 x 64 = 384 + D x 162 = 13 x 256 = 3328
= 3567 in base 10
= 418 in base 10
Remember, the digits in base 16 are
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

11

12 13

2
Decimal to hexadecimal Fractional part conv on 7 bits only

Convert (2607.565 )10 = (???)16


Start with the integer part :

Quotient Remainder Coefficient


(2607)10 / 16 162 15 (F) a0
162/16 10 2 a1
10/16 10 (A) a2

(2607)10 = (A2F)16

15 16

You might also like