Integer and Double typecasting in MQL

The math is simple:

155/32 = 4.84375

Not here:

void OnTick()
  {
   double tmp = 155/32;
   Print(tmp);
   MessageBox(DoubleToString(tmp,3));
}

I do not have any clue wath went wrong here!

Change to this:

void OnTick()
  {
   double tmp = 155/32.;
   Print(tmp);
   MessageBox(DoubleToString(tmp,3));
}

If you want a detailed explanation, have a read of the “Typecasting of Numeric Types” section of this article - https://docs.mql4.com/basis/types/casting

I know typecasting - thats why i wonder:

int/int => double ??

double ??" alt=“int/int => double ??” style=“vertical-align: middle;”>

You supplied 2 integers (155 and 32).

The result was then cast as a double.

Something like this:

int    int_tmp = 155/32;
double dbl_tmp = (double)int_tmp;

See On MT4 v434, division quotient don’t give floating point values(Bug??) - MQL4 forum

thanks…