//+------------------------------------------------------------------+ //| mt4mathBug.mq4 | //| John Taylor | //| http://www.linkedin.com/in/johntaylorhk | //+------------------------------------------------------------------+ #property copyright "John Taylor" #property link "http://www.linkedin.com/in/johntaylorhk" // Output received: // 2011.01.18 12:03:55 mt4mathBug USDCAD,H1: 1 -> 0 -> 1 -> 0 int start() { test(); return(0); } void test() { /* int i1=(1.0-0.8)/0.2;//=0! int i2=MathRound((1.0-0.8)/0.2);//=1 int i3=MathAbs ((1.0-0.8)/0.2);//=0! Print((1.0-0.8)/0.2," -> ",i1," -> ",i2," -> ",i3); */ // solution #1 double d1=(1.0-0.8)/0.2; double d2=MathRound((1.0-0.8)/0.2); double d3=MathAbs ((1.0-0.8)/0.2); Print((1.0-0.8)/0.2," -> ",d1," -> ",d2," -> ",d3); // solution #2 double d4=NormalizeDouble(1.0-0.8,8); int i1=d4/0.2; int i2=MathRound(d4/0.2); int i3=MathAbs (d4/0.2); Print((1.0-0.8)/0.2," -> ",i1," -> ",i2," -> ",i3); }