This discussion is archived
1 2 Previous Next 22 Replies Latest reply: Jan 31, 2009 5:02 AM by 807588 RSS

float operations giving incorrect answers

807588 Newbie
Currently Being Moderated
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