Download MetaTrader 5

Substraction error... Digits doesn't work right... - page 3

To add comments, please log in or register
whroeder1 2014.11.13 16: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
Ian Venner
Ian Venner 2014.11.13 17: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.

SYED NAUFAL GADDAFI 2014.11.13 18:09  
To be honest, I also never expected it is this bad.
To add comments, please log in or register