Now the output of this is 0.8999996 when it should have been 0.90.
float troco = 10.9F; troco = troco - 10; System.out.println(troco);
elvispt wrote:Of course it does. It's still a floating point number, represented the same way, just with greater precision. I never said that using double would make this issue vanish.
double ends up doing (almost) the same thing.
Learning how to solve that simple piece of code would go a long way.So take the time to read one or more of the links I provided. I'm not interested in providing a turnkey solution, but I'm happy to help you learn the concepts so you can understand what's going on and how to work with it.