English

Guard digit

In numerical analysis, one or more guard digits can be used to reduce the amount of roundoff error. In numerical analysis, one or more guard digits can be used to reduce the amount of roundoff error. For 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. Guard digits are also used in floating point operations in most computer systems. Given 2 1 × 0.100 2 − 2 0 × 0.111 2 {displaystyle 2^{1} imes 0.100_{2}-2^{0} imes 0.111_{2}} we have to line up the binary points. This means we must add an extra digit to the first operand—a guard digit. This gives us 2 1 × 0.1000 2 − 2 1 × 0.0111 2 {displaystyle 2^{1} imes 0.1000_{2}-2^{1} imes 0.0111_{2}} . Performing this operation gives us 2 1 × 0.0001 2 {displaystyle 2^{1} imes 0.0001_{2}} or 2 − 2 × 0.100 2 {displaystyle 2^{-2} imes 0.100_{2}} . Without using a guard digit we have 2 1 × 0.100 2 − 2 1 × 0.011 2 {displaystyle 2^{1} imes 0.100_{2}-2^{1} imes 0.011_{2}} , yielding 2 1 × 0.001 2 = {displaystyle 2^{1} imes 0.001_{2}=} or 2 − 1 × 0.100 2 {displaystyle 2^{-1} imes 0.100_{2}} . This gives us a relative error of 1. Therefore, we can see how important guard digits can be. An example of the error caused by floating point roundoff is illustrated in the following C code.

[ "Guard (information security)", "Binary number", "Floating point", "Numerical digit", "Rounding", "Multiplication", "Utility model" ]
Parent Topic
Child Topic
    No Parent Topic