1 2 Previous Next 22 Replies Latest reply: Feb 3, 2009 3:44 PM by 807588 RSS

    float operations giving incorrect answers

    807588
      Hi.

      I have quite a problem, that I don't know if anyone can help me with.
      Looking at the code and output explains better:
      float troco = 10.9F;
      troco = troco - 10;
      System.out.println(troco);
      Now the output of this is 0.8999996 when it should have been 0.90.

      Thank you for any help.
        1 2 Previous Next