double x= 2.2,y=2.13;
How can i do do operations like x+y or x-y * x/y? For example x-y should be 0.07 but java gives me 0.07000000000000028
double x= 2.2,y=2.13;
How can i do do operations like x+y or x-y * x/y? For example x-y should be 0.07 but java gives me 0.07000000000000028
You can use Math.round() function.
import java.lang.Math;
System.out.println(Math.round(x-y));