Share on Facebook Share on Twitter Email
Answers.com

Guard digit

 
Wikipedia: Guard digit

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 21 * 0.100 − 20 * 0.0111 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 21 * 0.1000 − 21 * 0.0111 performing this operation gives us 21 * 0.0001 or 2 − 2 * 0.100. Without using a guard digit we have 21 * 0.100 − 21 * 0.011 this yields 21 * 0.001 or 2 − 1 * 0.100. 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.

int main(){
   float a;
   int i;
   a = 0.2; a += 0.1; a -= 0.3;
   for(i=0 ; a<1.0 ; i++) a += a;
   printf(" i=%d a=%f\n",i,a);
   return 0;
}

It appears that the program should not terminate. Yet the output is : i=27 a=1.600000


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.

Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Guard digit" Read more