Substraction error... Digits doesn't work right...

Back to topics list  | 1 2 3 To post a new topic, please log in or register
WHRoeder 2014.11.13 17:49 #
SDC: I never realized it was this bad to do floating point calculations ...
  c = 2.220446049250313e-016 //oh dear ...

It's not bad to do floating point calculations, but you have to understand all three links at The == operand. - MQL4 forum

Until then you will still be expecting exact results from floating point. Oh dear. Stop printing them out like that. 

double spread = Ask - Bid;
Print( PriceToStr(spread) ); // 0.00021 not 0.00206123456789
                             // 0.00000 not 0.00000000000001
bool isAtOrAboveTrigger = MathAbs(Bid - trigger) > -_Point/2;
 // -0.0000000123456789 > -0.000005

SDC 2014.11.13 18:45 #

I have read all that a long time ago and i already know how long and convoluted they are, and what do you mean stop printing them out like that ?

Not every calculation is about comparing a price. Some of us work on more complex algorithms in indicators that require a lot of math and floating point calculations.

deysmacro 2014.11.13 19:09 #
To be honest, I also never expected it is this bad.
Back to topics list   | 1 2 3  

To add comments, please log in or register