EECS 1520
Week04.3 – January 26, 2018
page 1
Representing Real Numbers
Fractions
base:
b
any integer > 1
digits:
0
,
1
, ...,
b
−
1
number
0
1
2
2
1
d
d
d
d
d
n
n
−
−
.
3
2
1
−
−
−
d
d
d
its definition
3
3
2
2
1
1
0
0
1
1
2
2
2
2
1
1
−
−
−
−
−
−
−
−
−
−
×
+
×
+
×
+
×
+
×
+
×
+
+
×
+
×
b
d
b
d
b
d
b
d
b
d
b
d
b
d
b
d
n
n
n
n
Example
3.14 =
3
×
10
0
+ 1
×
10

1
+ 4
×
10

2
= 3 + .1 + .04
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
EECS 1520
Week04.3 – January 26, 2018
page 2
Conversions between Decimal and Binary
Binary to Decimal
Technique
•
use the definition of a number in a positional number system with base 2
•
evaluate the definition formula using decimal arithmetic
Example
10.1011
=
1
×
2
1
+
0
×
2
0
+
1
×
2

1
+
0
×
2

2
+
1
×
2

3
+
1
×
2

4
=
1
×
2 +
0
×
1 +
1
×
0.5 +
0
×
0.25 +
1
×
0.125 +
1
×
0.0625
= 2.6875 (decimal)
EECS 1520
Week04.3 – January 26, 2018
page 3
Decimal to Binary
Technique
• integer part: convert separately, as described before
• fraction part:
 repeatedly multiply by 2
 integer part (which is always 0 or 1) is the next digit
 binary fraction is developed left to right
Example
3.14579
•
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '13
 Lockhart
 William Kahan, Week04.3

Click to edit the document details