7 Replies Latest reply on Aug 30, 2007 5:38 PM by SymTsb

    Simple Math Calculation is incorrect

    injpix Level 3
      I have seen this topic here before but cant find it. When I do the following script it returns an incorrect value;

      var myNumber = 999.43
      trace(myNumber-999) //returns: 0.42999999999995

      So how can I retrieve the value .43? I suppose I can do this;

      var myNumber = 999.43
      var hundred = myNumber*100;
      var whole = hundred-99900;
      trace(whole*.01) // returns: .43

      But is there a better way? And why is it that Flash is calculating like this?