4 Replies Latest reply on Feb 13, 2007 11:24 PM by jpwrunyan

    Math problem (6.0-4.2=1.79)

    nodirbek13
      Hi,
      I have spent a day troubleshooting an issue with calculations ending up wrong and figured out this:
      6-4.2 (six minus four point two) evaluates to 1.7999999999999998
      No matter how you evaluate it...Here is how I checked
      trace(6-4.2);

      The results are funny when the numbers are fetched via parseFloat
      6-parseFloat(4.2000000000000000000000) evaluates to 1.8000000000000007
      6-parseFloat(4.20000000000000000000000) evaluates to 1.7999999999999998
      Can any one clarify this please?