StringFormat correct behaviour?

 

I saw StringFormat doesn't print correctly a double as an int. 

For example:

printf(StringFormat("int1=%i, int2=%d, double=%f",0.00356,0.00356*10000,0.00356));

and it yields:

int1=1918647790, int2=-858993459, double=0.003560

 

 

is this correct or is it a bug

Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
 

Try this code

printf(StringFormat("int1=%i, int2=%d, double=%f",0.00356,(int)(0.00356*10000),0.00356));
In future compiler will check parameters with format (first parameter of StringFormat function)
 
mql5:

Try this code

In future compiler will check parameters with format (first parameter of StringFormat function)

Thank you.

It came to me I should cast it myself to be sure.

Reason: