[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Precision Errors



PureBytes Links

Trading Reference Links

At 1:24 AM +0200 7/20/01, pierre.orphelin wrote:

>Clever solution by Bob Fulks, but this one could produce  average jumps if
>the mod function triggers after the TS Float (name it like you want)
>precision is reached before.

The only "jumps" that would occur are the shift from the value with
accumulated error to the correct value, which should be very small if
you recalculated the correct value every 100 bars. The calculation is:

      Sum = Sum[1] + Price - Price[Length];

There are abut 7 decimal digits of precision in the calculations so
assuming an average error of 0.5 in the seventh digit, 100
calculations should give an error of less than 50 in the seventh
digit or 0.5 in the fifth digit. So the "jump" should be less than
0.0005% in the Average. (This is a rough guess - there are formal
methods to figure this more accurately.)

>This could be the case for example if you perform average calculation on
>volume...

You are referring to averaging large numbers. Large numbers are not
normally a problem since the floating point arithmetic will
automatically move the decimal point as needed. Your proposed
solution:

    if sum> = 9999999- 2*price

seems to assume that there is a problem if "sum" exceeds 9999999.
That is not the case. It can be many orders of magnitude larger than
that without problems. The issue is the number of digits of
precision, not the absolute size of the numbers.

Bob Fulks