Peter wrote: >>> And how do you handle the precision of any non-rational numbers Like PI >>> for example ? Or anything that is not rational in the base you are using >>> for calculations ? >> >> pi = 3 +- 0.5; >> pi = 3.1 +- 0.05; >> pi = 3.14 +- 0.005; >> ... > > But pi appears as a constant or as the result of f.ex. atan(1.0)*4.0. Those two are completely different, just like in any numeric discussion. A constant pi (like above) has a defined precision; it is defined by the number of valid digits I used when defining the constant. A result of an atan() and multiplication operation has a precision that is derived from the properties of the algorithms and the precision of the inputs. The calculation could be analyzed as something like this: const float_prec c1 = float_prec( 1.0 ); // c1 has default precision, which is the // maximum precision to which the system // can transform a decimal value float_prec tmp = atan_prec( c1 ); // tmp has a precision that is calculated by // atan_prec(), based on the value and precision // of its input and the properties of the algorithm const float_prec c4 = float_prec( 4.0 ); // c4 has default precision float_prec result = mult_prec( tmp, c4 ); // Again, just like atan_prec(), mult_prec() // calculates not only the result, but also the // precision of the result, based on the values and // precisions of both input values and the properties // of the algorithm. Of course, depending on the language definition, this could all happen implicitly when writing "result=atan(1.0)*4.0". But for the sake of discussion, I think it makes it more obvious what happens under the hood. > Also any non-rational results from the calculations must be constrained > asap else the subsequent application will use the full available > precision. As I see it, results don't really get "constrained". It's rather that their precision gets defined, by the precision of the input and the precision of the algorithm (which of course in many cases is dependent on the input value). Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist