Errors, bugs, questions - page 744

 
IgorM:
Yes, I know, and I cited code that does not cause execution error, but loops the script

is the last print not output?

Or the penultimate?

And the last exponent call does not freeze?

Algorithm reaches what line?

did you put the prints everywhere?

 
sergeev: is the last Print not being output?

Yes, it isn't.

2012.05.27 23:44:15	34 (EURUSD,M15)	Abnormal termination
2012.05.27 23:44:14     34 (EURUSD,M15) out[0][1071644672][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][5][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][4][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][3][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][2][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][1][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][0][7] = 0.02401042497265053
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][6][7] = 0.6115035058049522
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][5][7] = 0.6315711056280579
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][4][7] = 0.2054980719299829
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][3][7] = 0.5596305561874292
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][2][7] = 0.3623413658485376
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][1][7] = 0.8933844140595046
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][0][7] = 0.9005057454076223
2012.05.27 23:44:14     34 (EURUSD,M15) out[0][1071644672][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][5][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][4][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][3][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][2][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][1][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][0][7] = 0.02401042497265053
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][6][7] = 0.6115035058049522
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][5][7] = 0.6315711056280579
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][4][7] = 0.2054980719299829
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][3][7] = 0.5596305561874292
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][2][7] = 0.3623413658485376
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][1][7] = 0.8933844140595046
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][0][7] = 0.9005057454076223
2012.05.27 23:44:14     34 (EURUSD,M15) out[0][1071644672][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][5][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][4][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][3][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][2][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][1][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][0][7] = 0.02401042497265053
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][6][7] = 0.6115035058049522
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][5][7] = 0.6315711056280579
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][4][7] = 0.2054980719299829
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][3][7] = 0.5596305561874292
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][2][7] = 0.3623413658485376
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][1][7] = 0.8933844140595046
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][0][7] = 0.9005057454076223
2012.05.27 23:44:14     34 (EURUSD,M15) out[0][1071644672][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][5][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][4][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][3][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][2][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][1][7] = 0.5
2012.05.27 23:44:14     34 (EURUSD,M15) out[2][0][7] = 0.02401042497265053
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][6][7] = 0.6115035058049522
2012.05.27 23:44:14     34 (EURUSD,M15) out[1][5][7] = 0.6315711056280579
2012.05.27 23:44:10     34 (EURUSD,M15) out[1][3][7] = 0.5596305561874292
2012.05.27 23:44:10     34 (EURUSD,M15) out[1][2][7] = 0.3623413658485376
2012.05.27 23:44:10     34 (EURUSD,M15) out[1][1][7] = 0.8933844140595046
2012.05.27 23:44:10     34 (EURUSD,M15) out[1][0][7] = 0.9005057454076223
2012.05.27 23:44:10     34 (EURUSD,M15) out[0][1071644672][7] = 0.5
2012.05.27 23:44:10     34 (EURUSD,M15) out[2][5][7] = 0.5
2012.05.27 23:44:10     34 (EURUSD,M15) out[2][4][7] = 0.5
2012.05.27 23:44:10     34 (EURUSD,M15) out[2][3][7] = 0.5
2012.05.27 23:44:10     34 (EURUSD,M15) out[2][2][7] = 0.5
2012.05.27 23:44:09     34 (EURUSD,M15) out[0][1071644672][7] = 0.5
2012.05.27 23:44:09     34 (EURUSD,M15) out[2][5][7] = 0.5
2012.05.27 23:44:09     34 (EURUSD,M15) out[2][4][7] = 0.5
2012.05.27 23:44:09     34 (EURUSD,M15) out[2][3][7] = 0.5
 
IgorM:

Yes, it isn't.

repeat question - do you have an exponent calculated for 2/3/8?

and also it looks strange.

1071644672
where is it coming from ?
 
sergeev: I'll repeat my question - do you have an exponent calculated for 2/3/8?

made it like this:

int i1,i2,i3;
double out[3][7][7];
for(i1=0;i1<7;i1++) out[0][0][i1] = inp[i1];
double sum;
sum = 0.0;
for(i3=0;i3<3;i3++){
   for(i2=0;i2<7;i2++){
      for(i1=1;i1<7;i1++)  sum += W[i3][i2][i1] * out[i3][i2][i1-1];
      if(i3==2 && i2==3 && i1==8) Print("неправильный вызов exp!!!!");
      out[i3][i2][i1] = f(sum + WT[i3][i2]);
      sum = 0.0;
      Print("out[",i3,"][",i2,"][",i1,"] = ",out[i3][i2][i1]);
   }
}
Print("sum = ",sum);

in the log:

2012.05.27 23:55:30     34 (EURUSD,M15) array out of range in '34.mq5' (180,7)

if commented out: // if(i3==2 && i2==3 && i1==8) Print("incorrect exp!!!! call");

again it will lead to an infinite loop :)

 
IgorM:

if blanked out:// if(i3==2 && i2==3 && i1==8) Print("wrong exp!!!! call");

again it will be an infinite loop :)

i1 equals 7 after the loop ends, although the maximum index of the third dimension is 6. It's supposed to be out of range, but if not, it's quite possible that the string

out[i3][i2][i1] = f(sum + WT[i3][i2]);

may overwrite the value of i2, for example. But in this case it's an error in the mql-compiler.

You can move, for example, array definition to global variables - then the behavior of the above code should change.

Документация по MQL5: Основы языка / Переменные / Глобальные переменные
Документация по MQL5: Основы языка / Переменные / Глобальные переменные
  • www.mql5.com
Основы языка / Переменные / Глобальные переменные - Документация по MQL5
 
IgorM:

it will be an endless loop again :)

I think the error is in the printer itself.

Find out what is on the lines before it. since the last exponent should not be executed. the index exceeds

I think the problem is in your code.

Документация по MQL5: Математические функции / MathExp
Документация по MQL5: Математические функции / MathExp
  • www.mql5.com
Математические функции / MathExp - Документация по MQL5
 
sergeev: I think the problem is in your code.
I have attached it, the script goes into an infinite loop like this
Files:
34.mq5  7 kb
 
sergeev:

and it also looks strange.

1071644672
where did it come from?
I think we can get a little closer to a clue if we rewrite this number in binary format.
 
IgorM:
I have it attached, in this form the script goes into an infinite loop.

I have Zero Devide with or without a print, on

double f(double x){return(1/(1+MathExp(-1*x)));}
In general, i1 takes wrong value. Although it should be out of range on out[][][7]. The compiler must consider restrictions based on multiplication of all dimensions (3 * 7 * 7 = 147) instead of each one. For example, if i1 is assigned 8, Print still prints some values. Obviously, it's a compiler error when checking array bounds.
 
notused:
Apparently, the compiler calculates constraints proceeding from multiplication of all the dimensions (3 * 7 * 7 = 147) and not each of them. For example, if i1 is assigned 8, Print still produces some values. Obviously, it's a compiler error when checking array bounds.

Out of range is not from the compiler. This is a Runtime error.

The runtime system has stupidly calculated the offset and nothing will happen if incorrect indexes were involved in the calculation, but you didn't go beyond the array's limits. But if you check the indexes in a smart way, each one separately, you'll get concrete lags at execution.

Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки времени выполнения
Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки времени выполнения
  • www.mql5.com
Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки времени выполнения - Документация по MQL5