precision and accuracy
- To: mathgroup at yoda.ncsa.uiuc.edu
- Subject: precision and accuracy
- From: uunet!yoda.ncsa.uiuc.edu!keiper%wri (Jerry Keiper)
- Date: Mon, 26 Mar 90 13:03:08 CST
uunet!renoir.Berkeley.EDU!fateman (Richard Fateman) writes: The notions of precision and accuracy as used in Mathematica are, in my view, wrong. I have argued at some length (and apparently with no effect) for a model in which a floating-point number's precision can be extended by adding 0's to its internal representation, if you wish. The mathematica model is (somewhat crudely) that if you write 0.5 you do not mean 0.500000... but any number between 0.450 and 0.5499.. . While this latter model may be reminiscent of a physics-lab approach of carrying significant figures in your measurements, it is not useful in computation. Numerical analysis texts talk about relative and absolute error, not precision and accuracy. I presume he is unhappy with Mathematica's use of significance arithmetic as opposed to fixed, but arbitrary precision arithmetic. These two models of arithmetic are indeed very different and they both have their advantages and disadvantages, but I have seen no convincing evidence that one is better than the other. Certainly significance arithmetic is very difficult to implement correctly and Mathematica has not yet achieved perfection in this matter, but the fact that most elementary numerical texts only discuss fixed precision arithmetic (note that they don't discuss arbitrary precision arithmetic either) is not a reason to reject significance arithmetic. As to increasing the precision of a number, Mathematica allows this to be done very simply using SetPrecision (likewise the accuracy can be increased with SetAccuracy.) y = SetPrecision[x, prec] gives y a value such that y == x is True and such that the precision of y is prec. If the precision of y is greater than the precision of x the "missing" digits of x are filled in for y with 0's in binary. This does not mean that they will appear as 0's in decimal however. e.g. the decimal number 1.2 has a nonterminating binary expansion 1.0011001100110011001100... Clearly if we start with a finite approximation to this and attach 0's in binary we will not get the decimal expansion for 1.200000000... Since it is not possible to know what number a user has in mind when he wants to increase its precision it is not possible to give a better approximation; all that Mathematica can do is give another number with more digits in it. As to relative and absolute error vs. precision and accuracy, precision is a nonnegative integer and accuracy is an integer. Relative and absolute error are small numbers, sometimes complex, but they are never known exactly (if they were the approximate answer could be corrected.) I find it more convenient to deal with an accuracy of 27 rather than an absolute error of 0.000000000000000000000000001, but perhaps not everyone does.