Question

3. Consider the following code

Python

num_start=1

spacing=num_start

while num_start+spacing!=num_start:

spacing/=2

print (2* spacing)

Matlab

format long

num_start=1;

spacing=num_start;

while num_start+spacing=num_start

end

2* spacing

spacing=spacing/2;

(a) Run the code (or rewrite it in a language of your choice and then run it) and report the

spacing (Emach) for your computer.

(b) Change the num_start variable to 10 and then 10¹5 and report the spacing between numbers

in these ranges.

(c) Change the num_start variable to 10-5 and then 105 and report the spacing between

numbers in these ranges.

(d) For which num_start is the spacing between numbers exactly 1?

(e) For what starting number is the spacing between numbers exactly 4?

Question image 1