*gawk:* FP Math Caution

15.4 Floating-Point Arithmetic: Caveat Emptor! ============================================== Math class is tough! -- _Teen Talk Barbie, July 1992_ This minor node provides a high-level overview of the issues involved when doing lots of floating-point arithmetic.(1) The discussion applies to both hardware and arbitrary-precision floating-point arithmetic. CAUTION: The material here is purposely general. If you need to do serious computer arithmetic, you should do some research first, and not rely just on what we tell you.

### Menu

· Inexactness of computations Floating point math is not exact. · Getting Accuracy Getting more accuracy takes some work. · Try To Round Add digits and round. · Setting precision How to set the precision. · Setting the rounding mode How to set the rounding mode. ---------- Footnotes ---------- (1) There is a very nice paper on floating-point arithmetic (http://www.validlab.com/goldberg/paper.pdf) by David Goldberg, "What Every Computer Scientist Should Know About Floating-Point Arithmetic," 'ACM Computing Surveys' *23*, 1 (1991-03): 5-48. This is worth reading if you are interested in the details, but it does require a background in computer science.