1 Reply Latest reply on Nov 14, 2007 7:15 AM by levancho

    Basic Match Problem

    Darkout_Full_Jazz
      Example 1
      var x:Number = 10.03;
      var y:Number = 0.07;
      var z:Number = 9.9;

      var total:Number = 0;
      total += x; //10.03
      total += y; //11.0000001
      total += z; //20.0000005 [ Why 0.0000005 ?]


      Example 2
      var x:Number = 20;
      var y:Number = 10.07;
      var z:Number = 9.93;

      var total:Number = 0;
      total = x; //total = 20
      total -= y; //total = 9.93000001 0.00000001?
      total -= z; //total = -4.1000005 The result must be 0 zero.

      How can I fix this?