Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

undefined Problem 6: Floating point-gap (16 Points) With integers, the gap between representations is always 1. This means that rounding a decimal to an integer

image text in transcribedundefined

Problem 6: Floating point-gap (16 Points) With integers, the gap" between representations is always 1. This means that rounding a decimal to an integer can introduce an error of up to 70.5. a) In a 32-bit IEEE floating point number, what is the smallest number greater than 0.75 that can be exactly represented? What is the gap between those two numbers? Briefly justify your answers. [5 points] b) Assume 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 0.75 and get a result that is still 0.75? [3 points] c) Redo part a) but for 10.75 rather than 0.75. [5 points] 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 points] Problem 6: Floating point-gap (16 Points) With integers, the gap" between representations is always 1. This means that rounding a decimal to an integer can introduce an error of up to 70.5. a) In a 32-bit IEEE floating point number, what is the smallest number greater than 0.75 that can be exactly represented? What is the gap between those two numbers? Briefly justify your answers. [5 points] b) Assume 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 0.75 and get a result that is still 0.75? [3 points] c) Redo part a) but for 10.75 rather than 0.75. [5 points] 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 points]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

What is a trigger? Provide an example of a trigger.

Answered: 1 week ago