Okay, I managed to resolve this BUG by applying the 'NormalizeDouble()' function to both variables prior to 'if' conditionals.
Range = NormalizeDouble(Range,2); avgRange = NormalizeDouble(avgRange,2);
However, I am still confused here! I assumed that there might have been a minor deviation between the values for some reason, maybe because each was calculated differently.
To test this out I used the 'DoubleToStr()' function to display both 'double' type values with maximum precision of 8 digits after decimal:
Alert(DoubleToStr(Range,8)," = ",DoubleToStr(avgRange,8));
The result was: 163.00000000 = 163.00000000
Again, EXACTLY IDENTICAL down to the 8th digit after decimal.
And yet still the condition:
if (Range>avgRange)
Was triggered!
This makes no sense at all!!!
Of course from now on I will always use the 'NormalizeDouble()' function to avoid this problem in the future, but again, am I missing something here, or is this in fact a BUG?
Thanks!
Of course from now on I will always use the 'NormalizeDouble()' function to avoid this problem in the future, but again, am I missing something here, or is this in fact a BUG?
Thanks!
Okay, I managed to resolve this BUG by applying the 'NormalizeDouble()' function to both variables prior to 'if' conditionals.
However, I am still confused here! I assumed that there might have been a minor deviation between the values for some reason, maybe because each was calculated differently.
To test this out I used the 'DoubleToStr()' function to display both 'double' type values with maximum precision of 8 digits after decimal:
The result was: 163.00000000 = 163.00000000
Again, EXACTLY IDENTICAL down to the 8th digit after decimal.
And yet still the condition:
Was triggered!
This makes no sense at all!!!
Of course from now on I will always use the 'NormalizeDouble()' function to avoid this problem in the future, but again, am I missing something here, or is this in fact a BUG?
Thanks!
Okay, thanks guys! Didn't know it went all the way up to 15 digits after decimal.
I'll have a read of that thread as well!
Thanks again!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a very simple code sample:
In my specific example, both variables 'Range' & 'avgRange' are of 'double' type and are IDENTICAL in value, equating to 163 respectively!
With that in mind, the first 'if' conditional should NEVER trigger, and yet it does!!!
I even added the part of:
Just to be sure, and here is the result:
I'm STUNNED O_O... WTF?
Is this some sort of BUG, or am I missing something here???
Thanks!!