| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Need some help to sort out an error https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=831 |
Page 2 of 2 |
| Author: | garyfritz [ Mon Sep 24, 2012 3:46 am ] |
| Post subject: | Re: Need some help to sort out an error |
FWIW: I tested MQL's double-to-int conversions with the code below. I checked double-to-int assignments, passing doubles for int parameters, and returning doubles from an int function. I tested those cases with both constants and double vars. I think that hits just about all the important cases. If you wanted to get really thorough you could also test all the combinations of ints and doubles in arithmetic expressions, but if it handles these cases right, I'd say it's pretty unlikely it doesn't handle math right. Everything worked like it should. The only surprise is that MQL truncates integers instead of rounding them, but that's a reasonable definition. So I don't think the DoubleToInt() function should be necessary at all, unless you want to round instead of truncating. And then you could just use MathRound() instead of DoubleToInt(). Code: Select all |
|
| All times are UTC | Page 2 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|