How to set number of decimals again!
Dough!I was to fast and did not ask the question right ;-)
I got code like this:
float x
public void updateX(int x)
{
this.x = this.x + (x/100f);
//Just for testing
System.out.println((this.x + (x/100f)));
}
I only want 2 decimal for x but I get like 8!!
For eg if I call updateX like below when x is 0.04:
updateX(1);
I get this value at x: 0.049999997
So what I need is a nice and neat float with just 2 decimals not a String, my fault Arne, sorry!
So the result needs to be a float with the correct sum of 0.04 + (1/100f) = 0.05f.
I'm pretty sure that this is possible but I do not remember how!
So if any one have the solution please let me know!
Fredrik
