0% found this document useful (0 votes)
59 views

Binary Representation: Major: All Engineering Majors Authors: Autar Kaw, Matthew Emmons

This document discusses binary representation and how decimal numbers can be converted to binary. It explains that decimal integers and fractions can both be broken down into a sum of powers of two in their binary representation. Decimal numbers are divided by two repeatedly to obtain the place values in binary. While most fractional decimals have an exact binary representation, some numbers like 0.6 or 1.6 result in an approximate representation when converted to binary. Additional resources on this topic are available at the provided URL.

Uploaded by

Harris Anches
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

Binary Representation: Major: All Engineering Majors Authors: Autar Kaw, Matthew Emmons

This document discusses binary representation and how decimal numbers can be converted to binary. It explains that decimal integers and fractions can both be broken down into a sum of powers of two in their binary representation. Decimal numbers are divided by two repeatedly to obtain the place values in binary. While most fractional decimals have an exact binary representation, some numbers like 0.6 or 1.6 result in an approximate representation when converted to binary. Additional resources on this topic are available at the provided URL.

Uploaded by

Harris Anches
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 14

6/12/2013 http://numericalmethods.eng.usf.

edu 1
Binary Representation
Major: All Engineering Majors

Authors: Autar Kaw, Matthew Emmons

http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates



Binary Representation



http://numericalmethods.eng.usf.edu



http://numericalmethods.eng.usf.edu 3
How a Decimal Number is
Represented
2 1 0 1 2
10 6 10 7 10 7 10 5 10 2 76 . 257

+ + + + =

http://numericalmethods.eng.usf.edu 4
Base 2
1875 . 11
) 2 1 2 1 2 0 2 0 (
) 2 1 2 1 2 0 2 1 (
) 0011 . 1011 (
10
4 3 2 1
0 1 2 3
2
=
|
|
.
|

\
|
+ + + +
+ + +
=


http://numericalmethods.eng.usf.edu 5
Convert Base 10 Integer to
binary representation
Table 1 Converting a base-10 integer to binary representation.
Quotient Remainder
11/2 5
5/2 2
2/2 1
1/2 0
0
1 a =
1
1 a =
2
0 a =
3
1 a =
Hence
2
2 0 1 2 3 10
) 1011 (
) ( ) 11 (
=
= a a a a

http://numericalmethods.eng.usf.edu 6
Start
Input (N)
10

i = 0
Divide N by 2 to get
quotient Q & remainder R
a
i
= R
Is Q = 0?
n = i
(N)
10
= (a
n
. . .a
0
)
2

STOP
Integer N to be
converted to binary
format
i=i+1,N=Q
No
Yes

http://numericalmethods.eng.usf.edu 7
Fractional Decimal Number
to Binary
Number
Number after
decimal
Number before
decimal
0.375 0.375
0.75 0.75
1.5 0.5
1.0 0.0
Table 2. Converting a base-10 fraction to binary representation.
1
0

= a
2
0

= a
3
1

= a
4
1

= a
Hence
2
2 4 3 2 1 10
) 0011 . 0 (
) ( ) 1875 . 0 (
=
=

a a a a
2 1875 . 0
2 375 . 0
2 75 . 0
2 5 . 0

http://numericalmethods.eng.usf.edu 8
Start
Input (F)
10

Multiply F by 2 to get
number before decimal,
S and after decimal, T
a
i
= R
Is T =0?
n = i
(F)
10
= (a
-1
. . .a
-n
)
2

STOP
Fraction F to be
converted to binary
format
No
Yes
T = = F 1, i i
1 i =

http://numericalmethods.eng.usf.edu 9
Decimal Number to Binary
( ) ( )
2 10
? . ? 1875 . 11 =
2 10
) 1011 ( ) 11 ( =
2 10
) 0011 . 0 ( ) 1875 . 0 ( =
and
we have
2 10
) 0011 . 1011 ( ) 1875 . 11 ( =
Since

http://numericalmethods.eng.usf.edu 10
All Fractional Decimal Numbers
Cannot be Represented Exactly
Number
Number
after
decimal
Number
before
Decimal
0.6 0.6
1.2 0.2
0.4 0.4
0.8 0.8
1.6 0.6
Table 3. Converting a base-10 fraction to approximate binary representation.
2 3 . 0
2 6 . 0
2 2 . 0
2 4 . 0
2 8 . 0
1
0

= a
2
1

= a
3
0

= a
4
0

= a
5
1

= a
28125 . 0 ) 01001 . 0 ( ) ( ) 3 . 0 (
2 2 5 4 3 2 1 10
= = ~

a a a a a

http://numericalmethods.eng.usf.edu 11
Another Way to Look at
Conversion
Convert to base 2
( )
10
1875 . 11
( )
( )
2
0 1 2 3
0 1 3
1 3
3
10
1011
2 1 2 1 2 0 2 1
2 2 2
1 2 2
3 2 11
=
+ + + =
+ + =
+ + =
+ =

http://numericalmethods.eng.usf.edu 12
( )
( )
2
4 3 2 1
4 3
3
10
0011 .
2 1 2 1 2 0 2 0
2 2
0625 . 0 2 1875 . 0
=
+ + + =
+ =
+ =

( ) ( )
2 10
0011 . 1011 1875 . 11 =
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit

http://numericalmethods.eng.usf.edu/topics/binary_repr
esentation.html

THE END



http://numericalmethods.eng.usf.edu

You might also like