//+------------------------------------------------------------------+ //| TestSpeed.mq5 | //| Copyright 2016, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2016, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { ulong t0,t1,t2; int y[],y1[]; ArrayResize(y,10000000); ArrayResize(y1,10000000); double x=1.45; for(int i=0;i<10000000;i++) { if ((int)(x+0.5)!=(int)round(x)) Print("ой...",x); x+=0.27; } x=1.45; t0=GetMicrosecondCount(); for(int i=0;i<10000000;i++) { y[i]=(int)MathRound(x); x+=0.27; } t1=GetMicrosecondCount()-t0; x=1.45; t0=GetMicrosecondCount(); for(int i=0;i<10000000;i++) { y[i]=(int)(x+0.5); x+=0.27; } t2=GetMicrosecondCount()-t0; Print("Цикл округления 10 000 000 раз: MathRound = ",IntegerToString(t1)," альтернатива с (int) = ",IntegerToString(t2)," микросекунд"); } //+------------------------------------------------------------------+