Binary And Hexadecimal Numeration And Logical Operations Worksheet - Object Oriented Programming In Java, Marian Manyo Page 6

ADVERTISEMENT

J A V A
L A B
M A N U A L
Decimal fraction to binary fraction
In the decimal numeration system, some fractions such as 3/4, 7/8, and 2/5 can be expressed as terminating
decimals 0.75, 0.875 and 0.4 respectively. However, other fractions, such as 1/6, 1/3 and 1/7, can only be
expressed as non – terminating, repeating decimals.
1/6 = 0.1666
1/3 = 0.333
1/7 = 0.142857142857
This is also true when expressing fractions in base 2. The fractions 3/4 and 7/8 are expressed in binary as
0.11 and 0.111 respectively. But, though 2/5 is a terminating decimal fraction, it is a non – terminating,
repeating binary fraction 0.01100110.
The algorithm in Section 1.1 converts a whole decimal numeral to a whole binary numeral by repeatedly
dividing by 2. In contrast, the algorithm to convert a fractional decimal numeral to a fractional binary
numeral uses repeated multiplication by 2.
The instructions that describe the process use this terminology from arithmetic:
multiplicand
0.4
multiplier
x 2
product
0.8
Note that when converting a mixed numeral such as 6
, the whole portion is converted with the first
2/5
algorithm, and the fractional portion is converted using the second algorithm.
The algorithm to convert a decimal fraction into a binary fraction
1. The
is the fractional portion of the decimal numeral to be converted.
multiplicand
2.
is -1
(
is the exponent of 2, 2
gives the place value)
n
n
n
3. Repeat instructions a – d while the
is not equal to 0 or more digits are needed to
multiplicand
determine the repeated pattern
a. Multiply the
by 2, finding a
multiplicand
product
l
o
n
b. The whole number portion of the
is the binary digit that belongs at place value
product
2
o
p
c. The new value for the
is the fractional portion of the
multiplicand
product
d. Decrease the value of
by one.
n
E x a m p l e Convert the decimal numeral 0.4 to binary.
n = -1
n = -2
n = -3
n = -4
DONE The new
START
0.4
0.8
0.6
0.2
multiplicand is 0.4,
x
2
x
2
x
2
x
2
which is a repeat
0.8
1.6
1.2
0.4
multiplicand.
Therefore, the pattern
is established.
.
0 1 1 0
A n s w e r 0.4 = 0.0110
2
P A G E 1 . 6
M A R I A N M A N Y O , M A R Q U E T T E U N I V E R S I T Y

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education