This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
1 / 2 = 0 What is wrong ???Back to topics list |
|
MichelB
2009.02.02 15:39
After hours spended to debug a code, I finally found this bug : int I = 2; Print("D = ", DoubleToStr(D, 8)); Result is 0.000000 (its really 0, as 1/D returns a zerodivide error) So, please, what is wrong ?? MT4 build 220, Vista 64 Thank you very much |
|
Rosh
2009.02.02 17:14
Use double I = 2; double D = (I - 1) / I; or int I = 2; double t = I; double D = (t - 1) / t; |
|
MichelB
2009.02.02 20:26
Rosh :
Use double I = 2; double D = (I - 1) / I; or int I = 2; double t = I; double D = (t - 1) / t; Thank you Rosh for your fast reply The first solution is not universal, sometime variables must be integer like arrays indices, period or shift of indicators. The second one seems a working workaround. I knew that there is no implicit casting for assignements, but I still dont understand why the inplicit casting is not working only for the division... Anyway, I will survive, Thanks again |
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
