Login Page - Create Account

Support Board


Date/Time: Sun, 12 Jan 2025 15:15:40 +0000



Post From: Rounding issues with sc.FormattedEvaluate

[2017-02-19 20:17:32]
@sstfrederik - Posts: 404
I have some unexpected rounding issues while using sc.FormattedEvaluate.


int Match = sc.FormattedEvaluate(StudyArray[sc.Index], sc.BaseGraphValueFormat, EQUAL_OPERATOR, StudyArray[sc.Index-1], sc.BaseGraphValueFormat) ? 1 : 0;

I am comparing current index float values from a SubGraph Array with values of the same Array one index back. sc.BaseGraphValueFormat in my ChartSettings is 0.01. When I check the output of the above code there are matches when it should not match and vice versa.

Some example output:

//did match but shouldn't
StudyArray = 2343.473633, PastStudyArray = 2343.475342, Match = 1 | 2017-02-19 14:50:55 *

//should match but didn't
StudyArray = 2342.526855, PastStudyArray = 2342.534180, Match = 0 | 2017-02-19 14:45:43 *
StudyArray = 2343.485840, PastStudyArray = 2343.492188, Match = 0 | 2017-02-19 14:56:30 *

//these should all match, only the first does
StudyArray = 2343.488525, PastStudyArray = 2343.492188, Match = 1 | 2017-02-19 14:57:14 *
StudyArray = 2343.486328, PastStudyArray = 2343.492188, Match = 0 | 2017-02-19 14:57:14 *
StudyArray = 2343.485596, PastStudyArray = 2343.492188, Match = 0 | 2017-02-19 14:57:14 *