1 a Show that 01 and 13 can be written as the following bina
1. (a) Show that 0.1 and 1/3 can be written as the following binary forms: 0.1 = (0.00011001100110011...)2
1 = (0.010101010...)2 3
(Hint: You can write the right hand binary number as the sum of a series of numbers, and show the sum equals the left side. For example
(0.00011001100110011...)2 = 24 + 25 + 28 + 29 + 212 + 213 + 216 + 217 + ... and then show the summation of the series equals to 0.1)
(b) Show how the following real numbers, 8.0, 5.5, 0.1, 1/3, are represented in single precision in IEEE standard, respectively.
For each of them, is there any rounding error for representing the given real number in the computer? If yes, what are the absolute error and the relative error, respectively?
Solution
I am solving the complete first question, post one more question to get the answer to second problem
1) a) Taking the RHS of the expression, we get
RHS = 2^(-4) + 2^(-5) + 2^(-8) + 2^(-9) + ....
Dividing it into two series
RHS = [2^(-4) + 2^(-8) + 2^(-12) + 2^(-16) + ... ] + [2^(-5) + 2^(-9) + 2^(-13) + 2^(-17) + ... ]
Using the infinite GP formulas, we get the sum as
RHS = 2^(-4)/(1-2^(-4)) + 2^(5)/(1-2^(-4)
RHS = (2^(-4) + 2^(-5))/(1-2^(-4))
RHS = (1/16 + 1/32)/ (15/16) = (3/32) * 16/15 = 3/30 = 0.1
1) b)
1/3 = 2^(-2) + 2^(-4) + 2^(-6) + ...
Taking the RHS
RHS = 2^(-2) + 2^(-4) + 2^(-6) + 2^(-8) + ....
Using the infinite GP formula, Sum = a/(1-r)
RHS = 2^(-2)/(1-2^(-2)) = 1/4/3/4 = 1/3
