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

Question Regarding Mathematical Operations in TS



PureBytes Links

Trading Reference Links

I would appreciate any help in understanding why the following happens
(please see comments in the code):

var: foo1(0), foo2(0);

If LastBarOnChart Then Begin
foo1 = 100.03125;
print(foo1:0:5); { will print 100.03100 - should be 100.03125 }
End;

If LastBarOnChart Then Begin
foo2 = 100.03125*100;
print(foo2:0:5); { will print 10003.10000 - should be 10003.125 }
End;

I appears that TS truncates, or perhaps rounds values prior to performing
mathematical operations - which is scary. I must be missing something simple
here. I have looked in the TS2000i online manual and can find nothing
regarding precision regarding TS mathematical operations.

Thanks,

JimD