The following routine is expected to return 1, but instead it returns 0.9999999999999999.
double sum = 0;
for(int i=0; i<10; i++){
sum+=0.1;
}
System.out.println(sum);
The same mistake occurs also with other java mathematical operations.
Is there any way to avoid this issue?
Thank you in advance.