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

Back to topics list To post a new topic, please log in or register
avatar
106
nanquan 2015.03.21 16:52
 

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
avatar
106
nanquan 2015.03.21 18:02 #
 
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'
avatar
12985
Back to topics list  

To add comments, please log in or register