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

Re: TS 5.0 Numerical Precision?



PureBytes Links

Trading Reference Links

Orphelin@xxxxxxx writes:
>
>> >Maybe you could propose a simple EL test code  that I could check
>>
>> Well, off the top of my head:
>>
>> X = 1.000000000010;
>> Y = 1.000000000015;
>>
>> Z = 1 / (X - Y);
>> plot1(Z, "test");
>>
>> If you get a divide-by-zero error, it's not double precision.
>
>I'll get one, anyway due to the internal EL security check to the division.
>
>However
>X = 1.000000000010;
>Y = 1.000000000015;
>
>if X-Y<>  then  Z = 1 / (X - Y);
> plot1(Z, "test");
>
>Should produce something <>0 (-0.2, if i'm correct).

Actually, X-Y is a very tiny number (that's the problem),
so its inverse is a very big (negative) number, something like:

   Z: -199999983451.92715454101562

The problem with single precision shows up most commonly when
you try to take the sum or difference of two numbers that are
very close in value.  You often run into this problem with
"series" functions, like Xaverage, or recursive filters
like butterworth, etc.

>This is not the case...unless you set Z to 0.2!

If I'm understanding you correctly, Pierre, you're saying that
in TS 5.0, the above test produces a divide-by-zero error,
meaning that TS 5.0 EL is using single precision.  
Have I got that right?

Thanks for checking, and let us know if I'm misunderstanding
your answer.

Jim