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
And let's leave the question about Print()'s defects unanswered, shall we? :)
Whatever.
OK. Then I'll take the nerve. So, the description of the Print() function says that "data of the double type are printed with the precision of 16 decimal digits after the point". In fact, it turns out that the Print() function outputs somewhat rounded data:
void OnStart() { double a,b; a=7.0/200.0; b=7.0/a; Print("Print(b)=",b); Print("Print(DoubleToString(b,16))=",DoubleToString(b,16)); }
MP 0 victorg2 (EURUSD,M1) 11:04:42 Print(DoubleToString(b,16))=199.9999999999999716
OK. Then I'll take the nerve. So, the description of the Print() function says that "data of the double type are printed with the precision of 16 decimal digits after the point". Actually it turned out that the Print() function produces slightly rounded data:
MP 0 victorg2 (EURUSD,M1) 11:04:42 Print(DoubleToString(b,16))=199.999999999999999716
123.4567890123456(7>5, therefore rounded up)
Everything seems to fit the description. What's the problem? Are zeros not printed?
The bug is that the Print() function does not output"Data of type double with an accuracy of 16 decimal digits after the dot".
check
Print("Print(b)="+ b);
check
Didn't take the trouble to check.
First of all, the compiler generates "implicit conversion from 'number' to 'string' victorg2.mq5 12 22".
Second,
IS 0 victorg2 (EURUSD,M1) 17:46:45 Print(b)=200
PJ 0 victorg2 (EURUSD,M1) 17:46:45 Print(DoubleToString(b,16))=199.9999999999999716
Use the appropriate PrintFormat function for full format control:
Print defaults to the normal rounding mode of double to 4 digits. We will correct the documentation.Please give pointers (handles) to structures (preferably also to arrays, including static ones).
Wrapping in classes is often a bad solution:
2012.04.07 20:49:38 SizeOf_Test (USDJPY,M30) sizeof(SEmpty) = 0
Please give pointers (handles) to structures (preferably to arrays as well, including static ones).
In what sense and why?
1. in what sense and
2. why?
1.
CEmpty *C[]; // Это работает. SEmpty *S[]; // Error: 'SEmpty' - class type expected SizeOf_Test.mq5 19 1
To create arrays of pointers to structures (arrays). with subsequent initialization for(i){ S[i] = GetPointer(StaticStruct[i]); }
2. to keep solid (packed) arrays of meaningful data.
Important when dealing with data output to raw OpenCL buffers (or sending to DLL, writing to files, etc.)
At the same time, it is possible to reorder data accesses (for example, when sorting pointers) without rewriting the data.