Download MetaTrader 5

Simple Math, type 'double' returns 0 instead of correct result... I'm at a COMPLETE LOSS HERE!!! HELP! o_O

To add comments, please log in or register
Roman
338
Roman  

Can anyone make sense of this?

      double calc1, calc2;
      calc1 = 1000*(17.6/100);
      calc2 = calc1*(65/100);
      Alert("calc2=",DoubleToStr(calc2,2));

Here is what's returned:

Alert result

How is this possible???


Also tried this:

      double calc2;
      calc2 = 176*(65/100);
      Alert("calc2=",DoubleToStr(calc2,2));

The output once again:

Alert no.2


What the hell????!!!!?!?!?! o_O
Roman
338
Roman  
Okay nevermind, I figured it out... apparently when you type in '65' it sees it as 'int' type... so you need to type it as '65.0'
To add comments, please log in or register