I don't know whether this question is asked before. I couldn't find it in searches.
System.out.println(1.00 - 9*.10);
the above statement prints out 0.09999999999999998 instead of simply 0.01
I know this is a well known problem in JAVA but i want to know the reason why it is so. Can someone guide me to the implementation details of float and explain the reason.
9*0.1 = 0.9in decimal, but in base two it's approximately equal to0.900000000000001387778780781446, because there's no base two representation of0.9. But as mentioned by others this question has a lot of answers here already...