Starting from:

$35

E0251-Data Representation Solved

Data Representation

1.      Consider these two float approximations for the value of π – (i) 22/7, (ii) 0x40490FDB. In which binary position do they begin to differ? In which decimal position do they begin to differ?

2.      Assuming that real data is represented using IEEE single (double) precision floating point representation, calculate and explain how many times this C while loop will iterate. Verify your answer experimentally. float f=1.0;

while (f != 0.0) f = f / 2.0;

n

3.      Consider the real valued sum of the harmonic sequence ∑1/i . Write C functions that 

i=1 compute the float value by iterating (i) forwards (from i=1 upto i=n), and (ii) backwards (from i=n downto i=1). Observe that the sum depends on the order of summation (i.e., backward vs forward) for some values of n? Explain why this happens.

Submit an archive file (.zip or .tar) containing (1) a pdf file of your brief answers, and (2) the C programs that you wrote to arrive at the answers.

More products