This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
!= evaluates to true when equalBack to topics list | 1 2 |
|
lomme
2006.01.18 01:15
I think normalization is only useful for OrderSend() function.
And you should avoid "!=" or "==" for double values, if you can. Better use ">=" and "<=". |
|
ajw
2006.01.19 10:41
sub,
You should have learnt from the article that a computer cannot store a double precisely if it cannot be represented by a combination of the -ve powers of 2 within the constraints of the type. I would surmise that you cannot assign the result of the NormalizeDouble function to a variable. Therefore, you need to normalize a number whenever you are using it in a comparison. So, in your case: a = 1.2 - 1.0; if(NormalizeDouble(a, 4) == NormalizeDouble(0.2, 4)) { // do something } By having to explicitly state when you want to normalize a number should theoretically improve the performance of the code. Otherwise, it is up to the compiler to make its own determination of whether to normalize depending on the context that the double is being used. |
Back to topics list
| 1 2
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
