Question: Problem 5 (13 points): Floating point--mind the gap (Needs material from lecture 7 ) With integers, the gap between representations is always 1 . This

 Problem 5 (13 points): Floating point--mind the gap (Needs material from

Problem 5 (13 points): Floating point--mind the gap (Needs material from lecture 7 ) With integers, the "gap" between representations is always 1 . This means that rounding a decimal 0 an integer can introduce an error of up to 0.5. a) In a 32-bit IEEE floating point number, what is the smallest number greater than 1 that can be exactly represented? What is the gap between those two numbers? Briefly justify your answers. [4] b) Assuming we are always rounding to the nearest value we can exactly represent (rounding down in the case of ties), what is the largest value we can add to 1 and get a result that is still 1? [3] c) Redo part a) but for 22.75 rather than 1. [3] d) Briefly explain how the gap between floating point numbers might cause a programmer difficulties. In particular, consider a for loop where small values are being added to a larger number many thousands of times. [3]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!