Numerical Computing with IEEE Floating Point Arithmetic

Chapter 11: Cancellation

Overview

Consider the two numbers


and


The first number, x, is a 16-digit approximation to ?, while the second number agrees with ? to only 12 digits. Their difference is


This difference is in the normalized range of the IEEE single format. However, if we compute the difference z = x ? y in a C program, using the single format to store the variables x and y before doing the subtraction, and display the result to single precision, we find that the result displayed for z is


The reason is simple enough. The input numbers x and y are first converted from decimal to the single binary format; they are not exact floating point numbers, so the decimal to binary conversion requires some rounding. Because they agree to 12 digits, both x and y round to exactly the same single format number. Thus, all bits in their binary representation cancel when the subtraction is done; we say that we have a complete loss of accuracy in the computation z = x ? y.

If we use the double format to store x and y and their difference z, and if we display the result to double precision, we find that z has the value


This agrees with the exact answer (11.1) to about four digits, but what is the meaning of the other digits? The answer is that the result displayed...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Logic Adders
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.