1 1 15.4 Floating-Point Arithmetic: Caveat Emptor! 1 ============================================== 1 1 Math class is tough! 1 -- _Teen Talk Barbie, July 1992_ 1 1 This minor node provides a high-level overview of the issues involved 1 when doing lots of floating-point arithmetic.(1) The discussion applies 1 to both hardware and arbitrary-precision floating-point arithmetic. 1 1 CAUTION: The material here is purposely general. If you need to do 1 serious computer arithmetic, you should do some research first, and 1 not rely just on what we tell you. 1
1 · 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. 1 1 ---------- Footnotes ---------- 1 1 (1) There is a very nice paper on floating-point arithmetic 1 (http://www.validlab.com/goldberg/paper.pdf) by David Goldberg, "What 1 Every Computer Scientist Should Know About Floating-Point Arithmetic," 1 'ACM Computing Surveys' *23*, 1 (1991-03): 5-48. This is worth reading 1 if you are interested in the details, but it does require a background 1 in computer science. 1