↑ arvau

Wikipedia / Guard digit

In numerical analysis, one or more guard digits can be used to reduce the amount of roundoff error.

Example

Suppose that the final result of a long, multi-step calculation can be safely rounded off to N decimal places. That is to say, the roundoff error introduced by this final roundoff makes a negligible contribution to the overall uncertainty.

However, it is quite likely that it is not safe to round off the intermediate steps in the calculation to the same number of digits. Be aware that roundoff errors can accumulate. If M decimal places are used in the intermediate calculation, we say there are M−N guard digits.

In computing

Guard digits are also used in floating point operations in most computer systems.

. Here, the product notation indicates a binary floating point representation with the exponent of the representation given as a power of two and with the significand.

.

, twice as large as the correct result. Thus, in this example, the use of a guard digit led to a more accurate result.

An example of the error caused by floating point roundoff is illustrated in the following C code.

It appears that the program should not terminate. Yet the output is: i=54, a=1.000000

Another example is:

Take two numbers:

as the second one:

The addition of the two numbers is:

0.0256*10^2 2.3400*10^2 + ____________ 2.3656*10^2

.

See also

References

  • Forman S. Acton. Numerical Methods that Work, The Mathematical Association of America (August 1997).

  • Higham, Nicholas J. Accuracy and Stability of Numerical Algorithms, Washington D.C.: Society for Industrial & Applied Mathematics, 2002.