The Answer is the 100 and the 45 need to be stated as 100.0 and 45.0
Thank you
EK
Thank you
EK
if I do this it prints Correctly
double pi=3.141592653589793;
Print("PI number is ", DoubleToStr(pi,8));
but I do this, it divides incorrectly ?????
double Test = 0.0;
Test = (100 / 45);
Print(DoubleToStr(Test,6));
When I add this to a chart it prints out
2.000000
The last time I checked the correct answer is
2.222222
Why Can't Metatrader do Simple Division?
EK
double pi=3.141592653589793;
Print("PI number is ", DoubleToStr(pi,8));
but I do this, it divides incorrectly ?????
double Test = 0.0;
Test = (100 / 45);
Print(DoubleToStr(Test,6));
When I add this to a chart it prints out
2.000000
The last time I checked the correct answer is
2.222222
Why Can't Metatrader do Simple Division?
EK
It can be also
100.0 / 45
100 / 45.0
100.0 / 45
100 / 45.0
The Answer is the 100 and the 45 need to be stated as 100.0 and 45.0
Thank you
EK
Thank you
EK
That is definitely a bug. If the numbers don't have decimal points, it should still give you the right answer as long as you have defined the variable to store the result as a double. Metaquotes may disagree with me, but that is a BUG. It may not be a biggie, but subtlelities like this can be dangerous.
No. There is no bug. Please read about implicit type casting.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
double pi=3.141592653589793;
Print("PI number is ", DoubleToStr(pi,8));
but I do this, it divides incorrectly ?????
double Test = 0.0;
Test = (100 / 45);
Print(DoubleToStr(Test,6));
When I add this to a chart it prints out
2.000000
The last time I checked the correct answer is
2.222222
Why Can't Metatrader do Simple Division?
EK