next up previous contents
Next: The Guard Digit Up: Computer Representation of Numbers Previous: Arithmetic Operations   Contents

IEEE Arithmetic

The IEEE standard specifies that the result of an arithmetic operation (+,-,*,/) must be computed exactly and then rounded to nearest. In other words,




The same requirement holds for square root, remainder, and conversions between integer and floating point formats: compute the result exactly, then round.

This IEEE convention completely specifies the result of arithmetic operations; operations performed in this manner are called exactly, or correctly rounded. It is easy to move a program from one machine that supports IEEE arithmetic to another. Since the results of arithmetic operations are completely specified, all the intermediate results should coincide to the last bit (if this does not happen, we should look for software errors!).

(Note that it would be nice to have the results of transcendental functions like exp(x) computed exactly, then rounded to the desired precision; this is however impractical, and the standard does NOT require correctly rounded results in this situation.)

Performing only correctly rounded operations seems like a natural requirement, but it is often difficult to implement it in hardware. The reason is that if we are to find first the exact result we may need additional resources. Sometimes it is not at all possible to have the exact result in hand - for example, if the exact result is a periodic number (in our toy system, 2.0/3.0 = 0.666...).


next up previous contents
Next: The Guard Digit Up: Computer Representation of Numbers Previous: Arithmetic Operations   Contents
Adrian Sandu 2001-08-26