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

How A Decimal Number Is Represented

This document discusses how decimal numbers are represented in binary format. It explains that decimal numbers can be broken down into a sum of powers of two by repeatedly dividing the number by two and recording the remainders as binary digits. Both integers and fractional decimal numbers can be converted to binary representations in this way, although some fractional numbers have repeating binary representations that cannot be expressed exactly. Examples are provided to demonstrate how to convert specific decimal numbers to their binary equivalents.

Uploaded by

Hajer Al Sabei
Copyright
© Attribution Non-Commercial (BY-NC)
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)
26 views

How A Decimal Number Is Represented

This document discusses how decimal numbers are represented in binary format. It explains that decimal numbers can be broken down into a sum of powers of two by repeatedly dividing the number by two and recording the remainders as binary digits. Both integers and fractional decimal numbers can be converted to binary representations in this way, although some fractional numbers have repeating binary representations that cannot be expressed exactly. Examples are provided to demonstrate how to convert specific decimal numbers to their binary equivalents.

Uploaded by

Hajer Al Sabei
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 12

http://numericalmethods.eng.usf.

edu 1
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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
( )
( )
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